private void commit(long targetIndex){ if(targetIndex > this.quickCommitIndex){ this.quickCommitIndex = targetIndex; // if this is a leader notify peers to commit as well // for peers that are free, send the request, otherwise, set pending commit flag for that peer if(this.role == ServerRole.Leader){ for(PeerServer peer : this.peers.values()){ if(!this.requestAppendEntries(peer)){ peer.setPendingCommit(); } } } } if(this.logStore.getFirstAvailableIndex() - 1 > this.state.getCommitIndex() && this.quickCommitIndex > this.state.getCommitIndex()){ this.commitingThread.moreToCommit(); } }
private void commit(long targetIndex){ if(targetIndex > this.quickCommitIndex){ this.quickCommitIndex = targetIndex; // if this is a leader notify peers to commit as well // for peers that are free, send the request, otherwise, set pending commit flag for that peer if(this.role == ServerRole.Leader){ for(PeerServer peer : this.peers.values()){ if(!this.requestAppendEntries(peer)){ peer.setPendingCommit(); } } } } if(this.logStore.getFirstAvailableIndex() - 1 > this.state.getCommitIndex() && this.quickCommitIndex > this.state.getCommitIndex()){ this.commitingThread.moreToCommit(); } }
private void commit(long targetIndex){ if(targetIndex > this.quickCommitIndex){ this.quickCommitIndex = targetIndex; // if this is a leader notify peers to commit as well // for peers that are free, send the request, otherwise, set pending commit flag for that peer if(this.role == ServerRole.Leader){ for(PeerServer peer : this.peers.values()){ if(!this.requestAppendEntries(peer)){ peer.setPendingCommit(); } } } } if(this.logStore.getFirstAvailableIndex() - 1 > this.state.getCommitIndex() && this.quickCommitIndex > this.state.getCommitIndex()){ this.commitingThread.moreToCommit(); } }