Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Use raft rpc connnection timeout parameter.

Kishore Nallan38d7d385f8e3
diff --git a/src/raft_server.cpp b/src/raft_server.cpp
index 0f332bd6..ed11e666 100644
--- a/src/raft_server.cpp
+++ b/src/raft_server.cpp
@@ -17,6 +17,7 @@ namespace braft {
DECLARE_int32(raft_max_append_entries_cache_size);
DECLARE_int32(raft_max_byte_count_per_rpc);
+ DECLARE_int32(raft_rpc_channel_connect_timeout_ms);
}
void ReplicationClosure::Run() {
@@ -80,6 +81,8 @@ int ReplicationState::start(const butil::EndPoint & peering_endpoint, const int
// flag controls snapshot download size of each RPC
braft::FLAGS_raft_max_byte_count_per_rpc = snapshot_max_byte_count_per_rpc;
+ braft::FLAGS_raft_rpc_channel_connect_timeout_ms = 2000;
+
// automatic snapshot is disabled since it caused issues during slow follower catch-ups
node_options.snapshot_interval_s = -1;
diff --git a/src/typesense_server_utils.cpp b/src/typesense_server_utils.cpp
index 64b945fa..7aaf8411 100644
--- a/src/typesense_server_utils.cpp
+++ b/src/typesense_server_utils.cpp
@@ -292,9 +292,6 @@ int start_raft_server(ReplicationState& replication_state, const std::string& st
exit(-1);
}
- // 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 = 5000;
if (replication_state.start(peering_endpoint, api_port, election_timeout_ms, snapshot_max_byte_count_per_rpc, state_dir,