alievmirza commented on code in PR #937:
URL: https://github.com/apache/ignite-3/pull/937#discussion_r926521237


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -135,6 +135,18 @@ public void onWrite(Iterator<CommandClosure<WriteCommand>> 
iterator) {
                 return;
             }
 
+            long newAppliedIndex = clo.appliedIndex();

Review Comment:
   lastApplied



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/VersionedRowStore.java:
##########
@@ -69,6 +72,22 @@ public class VersionedRowStore {
     public VersionedRowStore(@NotNull MvPartitionStorage storage, @NotNull 
TxManager txManager) {
         this.storage = Objects.requireNonNull(storage);
         this.txManager = Objects.requireNonNull(txManager);
+
+        Set<RowId> ids = new HashSet<>();
+
+        storage.forEach((rowId, binaryRow) -> {
+            if (ids.add(rowId)) {
+                primaryIndex.put(binaryRow.keySlice(), rowId);
+            }
+        });
+    }
+
+    public void appliedIndex(long appliedIndex) {

Review Comment:
   This java doc is not clear, lets use definition similar to raft paper 
definition: `lastApplied` -- index of highest log entry applied to state 
machine (page 4 https://raft.github.io/raft.pdf)



##########
modules/raft-client/src/main/java/org/apache/ignite/raft/client/service/CommandClosure.java:
##########
@@ -28,6 +28,14 @@
  * @see RaftGroupListener
  */
 public interface CommandClosure<R extends Command> {
+    /**
+     * Corresponding log index of the command. Present for write commands only.
+     * Returns {@code 0} for read commands.
+     */
+    default long appliedIndex() {

Review Comment:
   Let's try to follow the original Raft paper and Jraft and name it 
lastAppliedIndex. That should be changed all over the code



##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/MvPartitionStorage.java:
##########
@@ -30,6 +31,21 @@
  * <p>Each MvPartitionStorage instance represents exactly one partition.
  */
 public interface MvPartitionStorage extends AutoCloseable {
+    /**
+     * Last known replicator index. {@code 0} if index is unknown.
+     */
+    long appliedIndex();

Review Comment:
   Lets try to follow the original Raft paper and name it lastAppliedIndex



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