Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voteGranted值,在Vote 阶段是否会被Pre-Vote影响到 #48

Open
yunyun22 opened this issue Sep 2, 2022 · 0 comments
Open

voteGranted值,在Vote 阶段是否会被Pre-Vote影响到 #48

yunyun22 opened this issue Sep 2, 2022 · 0 comments

Comments

@yunyun22
Copy link

yunyun22 commented Sep 2, 2022

由于某些原因,如果preVote的回调晚于startVote,那么存在 voteGranted的值是STATE_PRE_CANDIDATE阶段的,而不是STATE_CANDIDATE阶段。voteGranted的赋值是否应该放在条件判断之后?或者是我忽略了某些细节,导致理解不正确?

    private class PreVoteResponseCallback implements RpcCallback<RaftProto.VoteResponse> {
        @Override
        public void success(RaftProto.VoteResponse response) {
            lock.lock();
            try {
                //这里的赋值,是否应该放在条件判断之后?
                peer.setVoteGranted(response.getGranted());
                if (currentTerm != request.getTerm() || state != NodeState.STATE_PRE_CANDIDATE) {
                    LOG.info("ignore preVote RPC result");
                    return;
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant