Increase election time out.

This commit is contained in:
kishorenc 2020-07-14 20:08:40 +05:30
parent 3e82089423
commit f5eb2c164e

View File

@ -244,7 +244,13 @@ int start_raft_server(ReplicationState& replication_state, const std::string& st
exit(-1);
}
if (replication_state.start(peering_endpoint, api_port, 1000, 600, state_dir, nodes_config_op.get()) != 0) {
// NOTE: braft uses `election_timeout_ms / 2` as the brpc channel `timeout_ms` configuration,
// which in turn is the upper bound for brpc `connect_timeout_ms` value.
// Reference: https://github.com/apache/incubator-brpc/blob/122770d/docs/en/client.md#timeout
size_t election_timeout_ms = 4000;
if (replication_state.start(peering_endpoint, api_port, election_timeout_ms, 600, state_dir,
nodes_config_op.get()) != 0) {
LOG(ERROR) << "Failed to start peering state";
exit(-1);
}