szetszwo commented on code in PR #647:
URL: https://github.com/apache/ratis/pull/647#discussion_r893061842
##########
ratis-server-api/src/main/java/org/apache/ratis/statemachine/StateMachine.java:
##########
@@ -189,6 +189,12 @@ default void notifyGroupRemove() {}
* @param failedEntry The failed log entry, if there is any.
*/
default void notifyLogFailed(Throwable cause, LogEntryProto failedEntry) {}
+
+ /**
+ * Notify the {@link StateMachine} that the progress of install snapshot is
+ * completely done. Could trigger the cleanup of snapshots.
+ */
+ default void
notifyInstallSnapshotFinished(RaftProtos.InstallSnapshotResult result) {}
Review Comment:
Since this method is for the state machine to clean up, it is useful to pass
also the snapshot index.
BTW, let's rename this to notifySnapshotInstalled as below.
```
default void notifySnapshotInstalled(InstallSnapshotResult result, long
snapshotIndex) {}
```
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -314,6 +320,7 @@ private InstallSnapshotReplyProto
notifyStateMachineToInstallSnapshot(
LOG.info("{}: InstallSnapshot notification result: {}, at index: {}",
getMemberId(),
InstallSnapshotResult.SNAPSHOT_INSTALLED,
latestInstalledSnapshotTermIndex);
inProgressInstallSnapshotIndex.set(INVALID_LOG_INDEX);
+ successInstalledSnapshot.set(true);
Review Comment:
Let's also call notifySnapshotInstalled here.
```
server.getStateMachine().event().notifySnapshotInstalled(
InstallSnapshotResult.SNAPSHOT_INSTALLED, installedIndex);
```
--
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]