runzhiwang opened a new pull request #64: URL: https://github.com/apache/incubator-ratis/pull/64
**What's the problem ?**  **What's the reason ?** The reason is follower update commitInfoCache after leader. The stack of follower update commitInfoCache is: RaftServerImpl::appendEntriesAsync -> state.updateStateMachine -> StateMachineUpdater::applyLog -> RaftServerImpl::applyLogToStateMachine -> RaftServerImpl::replyPendingRequest -> RaftServerImpl::getCommitInfos -> infos.add(commitInfoCache.update(getPeer(), state.getLog().getLastCommittedIndex())) -> CommitInfoCache::update. The stack of leader update commitInfoCache is: follower finish RaftServerImpl::appendEntriesAsync and return reply -> GrpcLogAppender::runAppenderImpl -> GrpcLogAppender::appendLog ->LogAppender::createRequest ->LeaderState::newAppendEntriesRequestProto ->RaftServerImpl::getCommitInfos ->LeaderState::updateFollowerCommitInfos ->CommitInfoCache::update. Because follower need to notify thread StateMachineUpdater to update CommitInfoCache, we can not ensure follower update CommitInfoCache before leader. **How to fix ?** Follower update CommitInfoCache before return reply to leader. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
