tkalkirill commented on code in PR #1800:
URL: https://github.com/apache/ignite-3/pull/1800#discussion_r1146280090
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -416,4 +416,39 @@ public void addToIndexes(@Nullable BinaryRow binaryRow,
RowId rowId) {
public void waitIndexes() {
indexes.get();
}
+
+ /**
+ * Builds an index for all versions of a row.
+ *
+ * <p>Index is expected to exist, skips the tombstones.
+ *
+ * @param indexId Index ID.
+ * @param rowUuids Row uuids.
+ * @param finish Index build completion flag.
+ */
+ public void buildIndex(UUID indexId, List<UUID> rowUuids, boolean finish) {
+ TableSchemaAwareIndexStorage index = indexes.get().get(indexId);
+
+ assert index != null : "indexId=" + indexId + ", partitionId=" +
partitionId;
+
+ RowId lastRowId = null;
+
+ for (UUID rowUuid : rowUuids) {
+ lastRowId = new RowId(partitionId, rowUuid);
+
+ try (Cursor<ReadResult> cursor = storage.scanVersions(lastRowId)) {
+ while (cursor.hasNext()) {
+ ReadResult next = cursor.next();
+
+ if (!next.isEmpty()) {
+ index.put(next.binaryRow(), lastRowId);
+ }
+ }
+ }
+ }
+
+ assert lastRowId != null || finish : "indexId=" + indexId + ",
partitionId=" + partitionId;
Review Comment:
So that the construction of the index in the raft group is consistent and
does not require additional actions.
--
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]