symious commented on code in PR #1068:
URL: https://github.com/apache/ratis/pull/1068#discussion_r1571623973


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -1805,17 +1805,17 @@ TransactionContext getTransactionContext(LogEntryProto 
entry, Boolean createNew)
   CompletableFuture<Message> 
applyLogToStateMachine(ReferenceCountedObject<LogEntryProto> nextRef)
       throws RaftLogIOException {
     LogEntryProto next = nextRef.get();
-    if (!next.hasStateMachineLogEntry()) {
-      stateMachine.event().notifyTermIndexUpdated(next.getTerm(), 
next.getIndex());
-    }
-
-    if (next.hasConfigurationEntry()) {
+    switch (next.getLogEntryBodyCase()) {
+    case CONFIGURATIONENTRY:
       // the reply should have already been set. only need to record
       // the new conf in the metadata file and notify the StateMachine.
       state.writeRaftConfiguration(next);
-      stateMachine.event().notifyConfigurationChanged(next.getTerm(), 
next.getIndex(), next.getConfigurationEntry());
+      stateMachine.event().notifyConfigurationChanged(next.getTerm(), 
next.getIndex(),
+          next.getConfigurationEntry());
       role.getLeaderState().ifPresent(leader -> leader.checkReady(next));
-    } else if (next.hasStateMachineLogEntry()) {
+      stateMachine.event().notifyTermIndexUpdated(next.getTerm(), 
next.getIndex());

Review Comment:
   @szetszwo Thank you for the review.
   
   I realized that I repeat it because I missed the point that 
`StateMachineLogEntry` will return inside the case. I changed this part also 
for a better readability. 



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