AngersZhuuuu opened a new pull request, #1111:
URL: https://github.com/apache/ratis/pull/1111

   ## What changes were proposed in this pull request?
   When we setting `INSTALL_SNAPSHOT_ENABLED_KEY` as true and when master sync 
snapshot to follower,
   the status will be PAUSED and won't take snapshot, also follower 
StateMachine will call `reinitialize()`.
   Then we need to load the the latest snapshot.
   ```
     /**
      * Re-initializes the State Machine in PAUSED state. The
      * state machine is responsible reading the latest snapshot from the file 
system (if any) and
      * initialize itself with the latest term and index there including all 
the edits.
      */
     void reinitialize() throws IOException;
   ```
   
   
   But current `SimpleStateMachineStorage` when init(), `latestSnapshot` was 
set. But the master's snapshot won't be taken so the `latestSnapshot` won't be 
updated to master's snapshot.
   
   So here we should load the latest snapshot and update it before do 
reinitialize.
   Similar thing was done in alluxio 
https://github.com/Alluxio/alluxio/blob/efed93c95e6f1cf3b2131066208f03cfd7821b58/dora/core/server/common/src/main/java/alluxio/master/journal/raft/JournalStateMachine.java#L209-L214
   
   and celeborn also meet such issue. 
https://github.com/apache/celeborn/pull/2547
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/RATIS-2111
   
   ## How was this patch tested?
   
   (Please explain how this patch was tested. Ex: unit tests, manual tests)
   (If this patch involves UI changes, please attach a screen-shot; otherwise, 
remove this)
   


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