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


##########
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:
   Curious why we need an assertion now (for example we might do a return or 
throw exception than an assertion)? 



##########
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:
   getLog() could throw IllegalStateException, do we want to catch it too?



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