mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix: Proper shutdown sequence with Namespaces (#3333)
This removes a race between periodic fiber and namespaces during shutdown.
This commit is contained in:
parent
e3eb8518fd
commit
4898b25b49
4 changed files with 20 additions and 5 deletions
|
@ -396,12 +396,16 @@ void EngineShard::Shutdown() {
|
|||
tiered_storage_.reset();
|
||||
}
|
||||
|
||||
DCHECK(!fiber_periodic_.IsJoinable());
|
||||
|
||||
ProactorBase::me()->RemoveOnIdleTask(defrag_task_);
|
||||
}
|
||||
|
||||
void EngineShard::StopPeriodicFiber() {
|
||||
fiber_periodic_done_.Notify();
|
||||
if (fiber_periodic_.IsJoinable()) {
|
||||
fiber_periodic_.Join();
|
||||
}
|
||||
|
||||
ProactorBase::me()->RemoveOnIdleTask(defrag_task_);
|
||||
}
|
||||
|
||||
void EngineShard::StartPeriodicFiber(util::ProactorBase* pb) {
|
||||
|
@ -895,6 +899,10 @@ void EngineShardSet::Init(uint32_t sz, bool update_db_time) {
|
|||
});
|
||||
}
|
||||
|
||||
void EngineShardSet::PreShutdown() {
|
||||
RunBlockingInParallel([](EngineShard* shard) { shard->StopPeriodicFiber(); });
|
||||
}
|
||||
|
||||
void EngineShardSet::Shutdown() {
|
||||
RunBlockingInParallel([](EngineShard*) { EngineShard::DestroyThreadLocal(); });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue