tkalkirill commented on code in PR #3233:
URL: https://github.com/apache/ignite-3/pull/3233#discussion_r1497078956


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/BuildIndexRowVersionChooser.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.distributed.raft;
+
+import static org.apache.ignite.internal.tx.TransactionIds.beginTimestamp;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexStatus;
+import org.apache.ignite.internal.storage.BinaryRowAndRowId;
+import org.apache.ignite.internal.storage.ReadResult;
+import org.apache.ignite.internal.storage.RowId;
+import org.apache.ignite.internal.util.Cursor;
+
+/** {@link BinaryRowAndRowId} chooser for index building. */
+class BuildIndexRowVersionChooser {
+    private final PartitionDataStorage storage;
+
+    /** Timestamp of activation of the catalog version in which the index 
created. */
+    private final long createIndexActivationTs;
+
+    /** Timestamp of activation of the catalog version in which the index 
start building (get {@link CatalogIndexStatus#BUILDING}). */
+    private final long startBuildingIndexActivationTs;
+
+    /**
+     * Constructor.
+     *
+     * @param storage Multi-version partition storage.
+     * @param createIndexActivationTs Timestamp of activation of the catalog 
version in which the index created.
+     * @param startBuildingIndexActivationTs Timestamp of activation of the 
catalog version in which the index start building
+     *      (get {@link CatalogIndexStatus#BUILDING}).
+     */
+    BuildIndexRowVersionChooser(PartitionDataStorage storage, long 
createIndexActivationTs, long startBuildingIndexActivationTs) {
+        this.storage = storage;
+        this.createIndexActivationTs = createIndexActivationTs;
+        this.startBuildingIndexActivationTs = startBuildingIndexActivationTs;
+    }
+
+    /**
+     * Collects binary versions of a row to build an index.
+     *
+     * <p>Index selection algorithm:</p>
+     * <ul>
+     *     <li>For writeCommitted with commitTs > activationTs(BUILDING), we 
will ignore.</li>
+     *     <li>For writeCommitted with commitTs <= activationTs(BUILDING), we 
will take the latest version.</li>

Review Comment:
   fix it



-- 
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]

Reply via email to