Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: shard lock module #853

Merged
merged 9 commits into from
Apr 25, 2023
5 changes: 4 additions & 1 deletion cluster/src/cluster_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct ClusterImpl {
}

impl ClusterImpl {
pub async fn create(
pub async fn try_new(
node_name: String,
shard_tables_cache: ShardTablesCache,
meta_client: MetaClientRef,
Expand All @@ -83,6 +83,9 @@ impl ClusterImpl {
shard_lock_key_prefix,
node_name,
etcd_client,
config.etcd_client.shard_lock_lease_ttl_sec,
config.etcd_client.shard_lock_lease_check_interval.0,
config.etcd_client.rpc_timeout.0,
runtime.clone(),
);
Ok(Self {
Expand Down
4 changes: 3 additions & 1 deletion cluster/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ pub struct EtcdClientConfig {
/// Root path in the etcd used by the ceresdb server
pub root_path: String,

/// Timeout to connect to etcd cluster
pub connect_timeout: ReadableDuration,
/// Timeout for each rpc request
pub rpc_timeout: ReadableDuration,

/// The lease of the shard lock in seconds.
Expand All @@ -61,7 +63,7 @@ impl Default for EtcdClientConfig {

rpc_timeout: ReadableDuration::secs(5),
connect_timeout: ReadableDuration::secs(5),
shard_lock_lease_ttl_sec: 15,
shard_lock_lease_ttl_sec: 30,
shard_lock_lease_check_interval: ReadableDuration::millis(200),
}
}
Expand Down
Loading