private void prepare() { synchronized (server) { if (running) { final RaftConfiguration conf = server.getRaftConf(); if (conf.isTransitional() && server.getState().isConfCommitted()) { // the configuration is in transitional state, and has been committed // so it is time to generate and replicate (new) conf. replicateNewConf(); } } } }
private void prepare() { synchronized (server) { if (running) { final RaftConfiguration conf = server.getRaftConf(); if (conf.isTransitional() && server.getState().isConfCommitted()) { // the configuration is in transitional state, and has been committed // so it is time to generate and replicate (new) conf. replicateNewConf(); } } } }
private void checkAndUpdateConfiguration(TermIndex[] entriesToCheck) { final RaftConfiguration conf = server.getRaftConf(); if (committedConf(entriesToCheck)) { if (conf.isTransitional()) { replicateNewConf(); } else { // the (new) log entry has been committed LOG.debug("{} sends success to setConfiguration request", server.getId()); pendingRequests.replySetConfiguration(); // if the leader is not included in the current configuration, step down if (!conf.containsInConf(server.getId())) { LOG.info("{} is not included in the new configuration {}. Step down.", server.getId(), conf); try { // leave some time for all RPC senders to send out new conf entry Thread.sleep(server.getMinTimeoutMs()); } catch (InterruptedException ignored) { } // the pending request handler will send NotLeaderException for // pending client requests when it stops server.shutdown(); } } } }
private void checkAndUpdateConfiguration(TermIndex[] entriesToCheck) { final RaftConfiguration conf = server.getRaftConf(); if (committedConf(entriesToCheck)) { if (conf.isTransitional()) { replicateNewConf(); } else { // the (new) log entry has been committed pendingRequests.replySetConfiguration(server::getCommitInfos); // if the leader is not included in the current configuration, step down if (!conf.containsInConf(server.getId())) { LOG.info("{} is not included in the new configuration {}. Step down.", server.getId(), conf); try { // leave some time for all RPC senders to send out new conf entry Thread.sleep(server.getMinTimeoutMs()); } catch (InterruptedException ignored) { } // the pending request handler will send NotLeaderException for // pending client requests when it stops server.shutdown(false); } } } }