private void logMetadata(long commitIndex) { raftLog.appendMetadata(currentTerm, commitIndex); notifySenders(); }
private void applyOldNewConf() { final ServerState state = server.getState(); final RaftConfiguration current = server.getRaftConf(); final RaftConfiguration oldNewConf= stagingState.generateOldNewConf(current, state.getLog().getNextIndex()); // apply the (old, new) configuration to log, and use it as the current conf long index = state.getLog().append(state.getCurrentTerm(), oldNewConf); updateConfiguration(index, oldNewConf); this.stagingState = null; notifySenders(); }
private void applyOldNewConf() { final ServerState state = server.getState(); final RaftConfiguration current = server.getRaftConf(); final RaftConfiguration oldNewConf= stagingState.generateOldNewConf(current, state.getLog().getNextIndex()); // apply the (old, new) configuration to log, and use it as the current conf long index = state.getLog().append(state.getCurrentTerm(), oldNewConf); updateConfiguration(index, oldNewConf); this.stagingState = null; notifySenders(); }
leaderState.notifySenders();
leaderState.notifySenders();
/** * when the (old, new) log entry has been committed, should replicate (new): * 1) append (new) to log * 2) update conf to (new) * 3) update RpcSenders list * 4) start replicating the log entry */ private void replicateNewConf() { final RaftConfiguration conf = server.getRaftConf(); final RaftConfiguration newConf = RaftConfiguration.newBuilder() .setConf(conf) .setLogEntryIndex(raftLog.getNextIndex()) .build(); // stop the LogAppender if the corresponding follower is no longer in the conf updateSenders(newConf); long index = raftLog.append(server.getState().getCurrentTerm(), newConf); updateConfiguration(index, newConf); notifySenders(); }
/** * when the (old, new) log entry has been committed, should replicate (new): * 1) append (new) to log * 2) update conf to (new) * 3) update RpcSenders list * 4) start replicating the log entry */ private void replicateNewConf() { final RaftConfiguration conf = server.getRaftConf(); final RaftConfiguration newConf = RaftConfiguration.newBuilder() .setConf(conf) .setLogEntryIndex(raftLog.getNextIndex()) .build(); // stop the LogAppender if the corresponding follower is no longer in the conf updateSenders(newConf); long index = raftLog.append(server.getState().getCurrentTerm(), newConf); updateConfiguration(index, newConf); notifySenders(); }