133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1746371780


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto 
checkAndInstallSnapshot(InstallSnapshotRequest
       state.setLeader(leaderId, "installSnapshot");
 
       
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+      if (snapshotChunkRequest.getRequestIndex() == 0) {
+        chunkRequestIndex.set(0);

Review Comment:
   I think both are ok.
   
   If chunkRequestIndex is initialized to -1, in the second if condition it 
should be like:
   else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex() - 
1)
   
   If chunkRequestIndex is initialized to 0, in the second if condition it 
should be like:
   else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex())
   
   The first indicates whether the previous chunk was successfully received
   
   The second one indicates which chunk should be received next.



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