ivandika3 commented on code in PR #1622:
URL: https://github.com/apache/ratis/pull/1622#discussion_r4236014139


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java:
##########
@@ -268,7 +268,12 @@ LeaderElection.ConfAndTerm initElection(Phase phase) 
throws IOException {
   }
 
   void persistMetadata() throws IOException {
-    getLog().persistMetadata(RaftStorageMetadata.valueOf(currentTerm.get(), 
votedFor));
+    try {
+      getLog().persistMetadata(RaftStorageMetadata.valueOf(currentTerm.get(), 
votedFor));
+    } catch (IOException e) {

Review Comment:
   Yes, good catch, any exception that is affecting persistence might cause 
correctness. Let's catch this. Updated.



##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -180,6 +180,7 @@ private CompletableFuture<InstallSnapshotReplyProto> 
checkAndInstallSnapshot(Ins
     final long lastIncludedIndex = lastIncluded.getIndex();
     final CompletableFuture<Void> future;
     synchronized (server) {
+      server.assertLifeCycleState(LifeCycle.States.STARTING_OR_RUNNING);

Review Comment:
   It is more of a convention in `installSnapshotImpl`, reflecting 
`appendEntriesAsync`. The exception generated will be `ServerNotReadyException` 
which should be acceptable.



##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java:
##########
@@ -268,7 +268,12 @@ LeaderElection.ConfAndTerm initElection(Phase phase) 
throws IOException {
   }
 
   void persistMetadata() throws IOException {
-    getLog().persistMetadata(RaftStorageMetadata.valueOf(currentTerm.get(), 
votedFor));
+    try {
+      getLog().persistMetadata(RaftStorageMetadata.valueOf(currentTerm.get(), 
votedFor));
+    } catch (IOException e) {

Review Comment:
   Yes, good catch, any exception that is affecting persistence might cause 
correctness issue. Let's catch this. Updated.



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