You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OnStartingFollowing(): When you add Node to leader, you receive a response from leader that returns "Not leader" (our own implementation).
Reason
In the internal process of jraft, node becomes leader - > sends leader heartbeat to all nodes - > other nodes become follower (asynchronous callback onStarting Following) - > leader receives all follower ACK (asynchronous callback onLeaderStart).
So visit leader in onStarting Following, and leader will report "Not leader" because it has not yet executed onLeaderStart (because our code sets leaderTerm in onLeaderStart).
Restoration plan
Do not judge leader based on leaderTerm, but directly on Node.isLeader().
Interim plan
In the short term, you can sleep in on StartingFollowing() for a few seconds (for example, 3s) and then visit the leader.