SzyWilliam commented on code in PR #1207:
URL: https://github.com/apache/ratis/pull/1207#discussion_r1906465412


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java:
##########
@@ -216,6 +216,9 @@ private void waitForCommit() throws InterruptedException {
     // Thus it is possible to have applied > committed initially.
     final long applied = getLastAppliedIndex();
     for(; applied >= raftLog.getLastCommittedIndex() && state == State.RUNNING 
&& !shouldStop(); ) {
+      if (server.getSnapshotRequestHandler().getPending().get().isPresent()) {

Review Comment:
   We shall use 
`server.getSnapshotRequestHandler().shouldTriggerTakingSnapshot()` in this 
scenario, see  
https://github.com/apache/ratis/blob/17c965292133114d6169feb19f32670e2b122032/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotManagementRequestHandler.java#L112-L114
 This method will clear the flag and guarantee one snapshot be taken each 
request. Otherwise, one request may trigger two snapshots.



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