diff --git a/db/periodic_task_scheduler.cc b/db/periodic_task_scheduler.cc index 1306f45da6..1c4fc16b1c 100644 --- a/db/periodic_task_scheduler.cc +++ b/db/periodic_task_scheduler.cc @@ -94,7 +94,7 @@ Status PeriodicTaskScheduler::Unregister(PeriodicTaskType task_type) { } Timer* PeriodicTaskScheduler::Default() { - static Timer timer(SystemClock::Default().get()); + STATIC_AVOID_DESTRUCTION(Timer, timer)(SystemClock::Default().get()); return &timer; } @@ -108,4 +108,3 @@ void PeriodicTaskScheduler::TEST_OverrideTimer(SystemClock* clock) { #endif // NDEBUG } // namespace ROCKSDB_NAMESPACE - diff --git a/unreleased_history/bug_fixes/avoid_destroying_timer.md b/unreleased_history/bug_fixes/avoid_destroying_timer.md new file mode 100644 index 0000000000..2a70b6b31a --- /dev/null +++ b/unreleased_history/bug_fixes/avoid_destroying_timer.md @@ -0,0 +1 @@ +Avoid destroying the periodic task scheduler's default timer in order to prevent static destruction order issues.