errose28 commented on a change in pull request #1705:
URL: https://github.com/apache/ozone/pull/1705#discussion_r547538068



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/upgrade/OMPrepareRequest.java
##########
@@ -184,26 +188,18 @@ private static void waitForLogIndex(long indexToWaitFor,
 
   /**
    * Take a snapshot of the state machine at the last index, and purge ALL 
logs.
-   * @param impl RaftServerImpl instance
+   * @param division Raft server division.
    * @throws IOException on Error.
    */
-  public static long takeSnapshotAndPurgeLogs(RaftServerImpl impl)
+  public static long takeSnapshotAndPurgeLogs(RaftServer.Division division)
       throws IOException {
 
-    StateMachine stateMachine = impl.getStateMachine();
+    StateMachine stateMachine = division.getStateMachine();
     long snapshotIndex = stateMachine.takeSnapshot();
-    RaftLog raftLog = impl.getState().getLog();
-    long raftLogIndex = raftLog.getLastEntryTermIndex().getIndex();
-
-    // Ensure that Ratis's in memory snapshot index is the same as the index
-    // of its last log entry.
-    if (snapshotIndex != raftLogIndex) {
-      throw new IOException("Snapshot index " + snapshotIndex + " does not " +
-          "match last log index " + raftLogIndex);
-    }

Review comment:
       It is possible that an extra Ratis transaction to commit the prepare 
request happens after we take the snapshot. This entry is internal to Ratis so 
it is not sent to the state machine. This is normal, but with this check in 
place, it would cause the prepare to fail. HDDS-4610 will wait on this extra 
transaction and update the DB with its index when the snapshot is taken, which 
will provide consistent behavior here, instead of the transaction getting 
included only sometimes.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to