tkalkirill commented on code in PR #3414:
URL: https://github.com/apache/ignite-3/pull/3414#discussion_r1528684518
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/index/IndexUpdateHandler.java:
##########
@@ -247,13 +249,52 @@ private TableSchemaAwareIndexStorage[]
indexesSnapshot(@Nullable List<Integer> i
* @throws StorageException If failed to set the row ID.
*/
public void setNextRowIdToBuildIndex(int indexId, @Nullable RowId rowId) {
+ TableSchemaAwareIndexStorage indexStorage =
indexStorageById().get(indexId);
+
+ // We assume that if the index is missing in indexStorageById, then it
has begun to be destroyed and we do not need it.
+ if (indexStorage != null) {
+ setNextRowIdToBuildToIndex(indexStorage, rowId);
+ }
+ }
+
+ private Map<Integer, TableSchemaAwareIndexStorage> indexStorageById() {
Map<Integer, TableSchemaAwareIndexStorage> indexStorageById =
indexes.get();
- TableSchemaAwareIndexStorage indexStorage =
indexStorageById.get(indexId);
+ assert !indexStorageById.isEmpty();
- if (indexStorage != null) {
- // TODO: IGNITE-21514 Handle index destruction
- indexStorage.storage().setNextRowIdToBuild(rowId);
+ return indexStorageById;
+ }
+
+ private static void putToIndex(TableSchemaAwareIndexStorage indexStorage,
BinaryRow binaryRow, RowId rowId) {
+ try {
+ indexStorage.put(binaryRow, rowId);
+ } catch (StorageDestroyedException ignore) {
+ // Index is in the process of being destroyed, which means there
is no need to write to it.
Review Comment:
I don’t think it’s necessary, the logs can be very littered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]