mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 20:00:36 +00:00
fix: deregister failure detector in region migration (#4293)
* fix: deregister failure detector in region migration * chore: apply suggestions from CR
This commit is contained in:
@@ -245,7 +245,7 @@ impl Context {
|
||||
/// Notifies the RegionSupervisor to register failure detectors of failed region.
|
||||
///
|
||||
/// The original failure detector was removed once the procedure was triggered.
|
||||
/// Now, we need to register the failure detector for the failed region.
|
||||
/// Now, we need to register the failure detector for the failed region again.
|
||||
pub async fn register_failure_detectors(&self) {
|
||||
let cluster_id = self.persistent_ctx.cluster_id;
|
||||
let datanode_id = self.persistent_ctx.from_peer.id;
|
||||
@@ -256,6 +256,20 @@ impl Context {
|
||||
.await;
|
||||
}
|
||||
|
||||
/// Notifies the RegionSupervisor to deregister failure detectors.
|
||||
///
|
||||
/// The original failure detectors was removed once the procedure was triggered.
|
||||
/// However, the `from_peer` may still send the heartbeats contains the failed region.
|
||||
pub async fn deregister_failure_detectors(&self) {
|
||||
let cluster_id = self.persistent_ctx.cluster_id;
|
||||
let datanode_id = self.persistent_ctx.from_peer.id;
|
||||
let region_id = self.persistent_ctx.region_id;
|
||||
|
||||
self.region_failure_detector_controller
|
||||
.deregister_failure_detectors(vec![(cluster_id, datanode_id, region_id)])
|
||||
.await;
|
||||
}
|
||||
|
||||
/// Removes the `table_route` of [VolatileContext], returns true if any.
|
||||
pub fn remove_table_route_value(&mut self) -> bool {
|
||||
let value = self.volatile_ctx.table_route.take();
|
||||
|
||||
@@ -175,6 +175,7 @@ impl UpdateMetadata {
|
||||
};
|
||||
|
||||
ctx.remove_table_route_value();
|
||||
ctx.deregister_failure_detectors().await;
|
||||
// Consumes the guard.
|
||||
ctx.volatile_ctx.opening_region_guard.take();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user