Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply suggestions from CR
Browse files Browse the repository at this point in the history
WenyXu committed Jun 25, 2024

Verified

This commit was signed with the committer’s verified signature.
WenyXu Weny Xu
1 parent c948c76 commit 900d4db
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/meta-srv/src/handler/failure_handler.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@

use api::v1::meta::{HeartbeatRequest, Role};
use async_trait::async_trait;
use common_telemetry::info;

use crate::error::Result;
use crate::handler::{HandleControl, HeartbeatAccumulator, HeartbeatHandler};
@@ -27,6 +28,7 @@ pub struct RegionFailureHandler {
impl RegionFailureHandler {
pub(crate) fn new(mut region_supervisor: RegionSupervisor) -> Self {
let heartbeat_acceptor = region_supervisor.heartbeat_acceptor();
info!("Starting region supervisor");
tokio::spawn(async move { region_supervisor.run().await });
Self { heartbeat_acceptor }
}
16 changes: 1 addition & 15 deletions src/meta-srv/src/metasrv/builder.rs
Original file line number Diff line number Diff line change
@@ -305,21 +305,7 @@ impl MetasrvBuilder {
let region_supervisor = RegionSupervisor::new(
options.failure_detector,
DEFAULT_TICK_INTERVAL,
// Requires to select MUST alive nodes.
SelectorContext {
server_addr: options.server_addr.clone(),
datanode_lease_secs: Duration::from_millis(
distributed_time_constants::HEARTBEAT_INTERVAL_MILLIS,
)
.as_secs(),
flownode_lease_secs: Duration::from_millis(
distributed_time_constants::HEARTBEAT_INTERVAL_MILLIS,
)
.as_secs(),
kv_backend: kv_backend.clone(),
meta_peer_client: meta_peer_client.clone(),
table_id: None,
},
selector_ctx.clone(),
selector.clone(),
region_migration_manager.clone(),
leader_cached_kv_backend.clone() as _,
3 changes: 2 additions & 1 deletion src/meta-srv/src/region/supervisor.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use std::time::Duration;

use common_meta::distributed_time_constants::HEARTBEAT_INTERVAL_MILLIS;
use common_meta::key::{TableMetadataManager, TableMetadataManagerRef, MAINTENANCE_KEY};
use common_meta::kv_backend::KvBackendRef;
use common_meta::peer::Peer;
@@ -139,7 +140,7 @@ impl Drop for RegionSupervisorTicker {
pub type RegionSupervisorRef = Arc<RegionSupervisor>;

/// The default tick interval.
pub const DEFAULT_TICK_INTERVAL: Duration = Duration::from_secs(1);
pub const DEFAULT_TICK_INTERVAL: Duration = Duration::from_millis(HEARTBEAT_INTERVAL_MILLIS);

/// The [`RegionSupervisor`] is used to detect Region failures
/// and initiate Region failover upon detection, ensuring uninterrupted region service.

0 comments on commit 900d4db

Please sign in to comment.