sanpwc commented on code in PR #3404:
URL: https://github.com/apache/ignite-3/pull/3404#discussion_r1523339142


##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1414,6 +1414,7 @@ else if (this.leaderId.isEmpty()) {
     }
 
     private void becomeLeader() {
+        this.fsmCaller.onBeforeLeaderStart();

Review Comment:
   > This is not the only place where node could become a leader.
   See org.apache.ignite.raft.jraft.core.NodeImpl#handleTransferTimeout
   Fixed.
   
   > If we want to call it here, we must call it after
   Requires.requireTrue(this.state == State.STATE_CANDIDATE, "Illegal state: " 
+ this.state);
   Nope, onBeforeLeaderStart is called when node is about to become a leader, 
however it's not guaranteed that it will happen, thus no preconditions 
expected. 
   



##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1414,6 +1414,7 @@ else if (this.leaderId.isEmpty()) {
     }
 
     private void becomeLeader() {
+        this.fsmCaller.onBeforeLeaderStart();

Review Comment:
   > This is not the only place where node could become a leader.
   See org.apache.ignite.raft.jraft.core.NodeImpl#handleTransferTimeout
   
   Fixed.
   
   
   > If we want to call it here, we must call it after
   Requires.requireTrue(this.state == State.STATE_CANDIDATE, "Illegal state: " 
+ this.state);
   
   Nope, onBeforeLeaderStart is called when node is about to become a leader, 
however it's not guaranteed that it will happen, thus no preconditions 
expected. 
   



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