mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-02 21:17:01 +00:00
compaction_manager: unregister compaction module on early shutdown
The compaction module is registered with task_manager in the compaction_manager
constructor, and unregistered in compaction_manager::really_do_stop(), which
was gated behind `_state != state::none` in compaction_manager::do_stop().
Since enable() -- which transitions _state from none to running -- is called
later during startup (from database::start() or the disk space monitor callback)
than the compaction_manager constructor, an early shutdown could leave the
compaction module registered after compaction_manager::do_stop() returned.
task_manager::stop() then aborted with 'Tried to stop task manager while
some modules were not unregistered'.
Fix compaction_manager::do_stop() to call _task_manager_module->stop() even
when `_state == state::none`, so that the compaction module is always properly
unregistered.
Fixes: SCYLLADB-2226
(cherry picked from commit 6cde390e21)
This commit is contained in:
committed by
scylladbbot
parent
81dc11557c
commit
bbde5a64b2
@@ -1301,9 +1301,16 @@ future<> compaction_manager::really_do_stop() noexcept {
|
||||
cmlog.info("Stopped");
|
||||
}
|
||||
|
||||
// Should return immediately when _state == state::none.
|
||||
void compaction_manager::do_stop() noexcept {
|
||||
if (_state == state::none || _stop_future) {
|
||||
if (_stop_future) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_state == state::none) {
|
||||
// Possible when the node shuts down before enable() is called,
|
||||
// e.g. due to an early startup failure. The task manager module
|
||||
// was registered in the constructor and must be unregistered.
|
||||
_stop_future = _task_manager_module->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user