@@ -277,6 +277,7 @@ pub struct ConfigViaEnv {
277277 pub kvsrv_snapshot_logs_since_last : u64 ,
278278 pub kvsrv_heartbeat_interval : u64 ,
279279 pub kvsrv_install_snapshot_timeout : u64 ,
280+ pub kvsrv_wait_leader_timeout : u64 ,
280281 pub raft_max_applied_log_to_keep : u64 ,
281282 pub kvsrv_single : bool ,
282283 pub metasrv_join : Vec < String > ,
@@ -320,6 +321,7 @@ impl From<Config> for ConfigViaEnv {
320321 kvsrv_snapshot_logs_since_last : cfg. raft_config . snapshot_logs_since_last ,
321322 kvsrv_heartbeat_interval : cfg. raft_config . heartbeat_interval ,
322323 kvsrv_install_snapshot_timeout : cfg. raft_config . install_snapshot_timeout ,
324+ kvsrv_wait_leader_timeout : cfg. raft_config . wait_leader_timeout ,
323325 raft_max_applied_log_to_keep : cfg. raft_config . max_applied_log_to_keep ,
324326 kvsrv_single : cfg. raft_config . single ,
325327 metasrv_join : cfg. raft_config . join ,
@@ -344,6 +346,7 @@ impl Into<Config> for ConfigViaEnv {
344346 snapshot_logs_since_last : self . kvsrv_snapshot_logs_since_last ,
345347 heartbeat_interval : self . kvsrv_heartbeat_interval ,
346348 install_snapshot_timeout : self . kvsrv_install_snapshot_timeout ,
349+ wait_leader_timeout : self . kvsrv_wait_leader_timeout ,
347350 max_applied_log_to_keep : self . raft_max_applied_log_to_keep ,
348351 single : self . kvsrv_single ,
349352 join : self . metasrv_join ,
@@ -483,6 +486,10 @@ pub struct RaftConfig {
483486 /// if not, the default name is used
484487 #[ clap( long, default_value = "foo_cluster" ) ]
485488 pub cluster_name : String ,
489+
490+ /// Max timeout(in milli seconds) when waiting a cluster leader.
491+ #[ clap( long, default_value = "70000" ) ]
492+ pub wait_leader_timeout : u64 ,
486493}
487494
488495impl Default for RaftConfig {
@@ -511,6 +518,7 @@ impl From<RaftConfig> for InnerRaftConfig {
511518 id : x. id ,
512519 sled_tree_prefix : x. sled_tree_prefix ,
513520 cluster_name : x. cluster_name ,
521+ wait_leader_timeout : x. wait_leader_timeout ,
514522 }
515523 }
516524}
@@ -535,6 +543,7 @@ impl From<InnerRaftConfig> for RaftConfig {
535543 id : inner. id ,
536544 sled_tree_prefix : inner. sled_tree_prefix ,
537545 cluster_name : inner. cluster_name ,
546+ wait_leader_timeout : inner. wait_leader_timeout ,
538547 }
539548 }
540549}
0 commit comments