Jie Yao created RATIS-1548:
------------------------------

             Summary: use stateMachine#lastAppliedIndex instead of 
stateMachinUpdater#lastAppliedIndex when check snapshot should be taken
                 Key: RATIS-1548
                 URL: https://issues.apache.org/jira/browse/RATIS-1548
             Project: Ratis
          Issue Type: Bug
            Reporter: Jie Yao


for now, the following is used to check whether a snapshot should be taken
{code:java}
return state == State.RUNNING && getLastAppliedIndex() - snapshotIndex.get() >= 
autoSnapshotThreshold; {code}
but `getLastAppliedIndex` is the index recorded by stateMachineUpdater, not 
state machine itself. in some other case (for example, om), the 
lastAppliedIndex of state machine will not be updated immediately after 
`applyTransaction` is called . in om , lastAppliedIndex will be updated until 
the ready queue of double buffer is flushed.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to