You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/11/01 14:43:13 UTC

[GitHub] [ignite-3] alievmirza commented on a diff in pull request #1280: IGNITE-17935 Finish implementation of streaming RAFT snapshot sender

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactory.java:
##########
@@ -77,44 +73,34 @@ public PartitionSnapshotStorageFactory(
             TopologyService topologyService,
             OutgoingSnapshotsManager outgoingSnapshotsManager,
             PartitionAccess partition,
-            List<String> peers,
-            List<String> learners,
             Executor incomingSnapshotsExecutor
     ) {
         this.topologyService = topologyService;
         this.outgoingSnapshotsManager = outgoingSnapshotsManager;
         this.partition = partition;
-        this.peers = peers;
-        this.learners = learners;
         this.incomingSnapshotsExecutor = incomingSnapshotsExecutor;
 
         // We must choose the minimum applied index for local recovery so that we don't skip the raft commands for the storage with the
         // lowest applied index and thus no data loss occurs.
-        persistedRaftIndex = Math.min(
-                partition.mvPartitionStorage().persistedIndex(),
-                partition.txStatePartitionStorage().persistedIndex()
+        lastIncludedRaftIndex = Math.min(
+                partition.mvPartitionStorage().lastAppliedIndex(),
+                partition.txStatePartitionStorage().lastAppliedIndex()
         );
     }
 
     @Override
-    public PartitionSnapshotStorage createSnapshotStorage(String uri, RaftOptions raftOptions) {
-        SnapshotMeta snapshotMeta = new RaftMessagesFactory().snapshotMeta()
-                .lastIncludedIndex(persistedRaftIndex)
-                // According to the code of org.apache.ignite.raft.jraft.core.NodeImpl.bootstrap, it's "dangerous" to init term with a value
-                // greater than 1. 0 value of persisted index means that the underlying storage is empty.
-                .lastIncludedTerm(persistedRaftIndex > 0 ? 1 : 0)

Review Comment:
   See this thread with more details https://github.com/apache/ignite-3/pull/937#discussion_r927744986



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org