Skip to content

Commit

Permalink
feat: ignore dropped region
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Jun 21, 2024
1 parent aac8fa3 commit e698cc6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/meta-srv/src/region/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use std::time::Duration;

use common_meta::key::MAINTENANCE_KEY;
use common_meta::key::{TableMetadataManager, TableMetadataManagerRef, MAINTENANCE_KEY};
use common_meta::kv_backend::KvBackendRef;
use common_meta::peer::Peer;
use common_meta::{ClusterId, DatanodeId};
Expand Down Expand Up @@ -151,6 +151,7 @@ pub struct RegionSupervisor {
region_migration_manager: RegionMigrationManagerRef,
// TODO(weny): find a better way
kv_backend: KvBackendRef,
table_metadata_manager: TableMetadataManagerRef,
}

pub(crate) struct HeartbeatSender {
Expand Down Expand Up @@ -191,6 +192,7 @@ impl RegionSupervisor {
selector_context,
selector,
region_migration_manager,
table_metadata_manager: Arc::new(TableMetadataManager::new(kv_backend.clone())),
kv_backend,
}
}
Expand Down Expand Up @@ -285,10 +287,22 @@ impl RegionSupervisor {
);
}
None => {
if self
.table_metadata_manager
.table_route_manager()
.table_route_storage()
.get(region_id.table_id())
.await
.context(error::TableMetadataManagerSnafu)?
.is_none()
{
return Ok(());
}

let mut peers = self
.selector
.select(
0,
cluster_id,
&self.selector_context,
SelectorOptions {
min_required_items: 1,
Expand Down

0 comments on commit e698cc6

Please sign in to comment.