compaction manager: remove: cleanup _compaction_state on exceptions
If for some reason an exception is thrown in compaction_manager::remove, it might leave behind stale table pointers in _compaction_state. Fix that by setting up a deffered action to perform the cleanup. Fixes #16635 Signed-off-by: Lakshmi Narayanan Sreethar <lakshmi.sreethar@scylladb.com> Closes scylladb/scylladb#16632
This commit is contained in:
committed by
Avi Kivity
parent
9e8998109f
commit
1d6eaf2985
@@ -2050,6 +2050,10 @@ void compaction_manager::add(table_state& t) {
|
||||
|
||||
future<> compaction_manager::remove(table_state& t) noexcept {
|
||||
auto& c_state = get_compaction_state(&t);
|
||||
auto erase_state = defer([&t, &c_state, this] () noexcept {
|
||||
c_state.backlog_tracker->disable();
|
||||
_compaction_state.erase(&t);
|
||||
});
|
||||
|
||||
// We need to guarantee that a task being stopped will not retry to compact
|
||||
// a table being removed.
|
||||
@@ -2064,10 +2068,6 @@ future<> compaction_manager::remove(table_state& t) noexcept {
|
||||
co_await std::move(close_gate);
|
||||
}
|
||||
|
||||
c_state.backlog_tracker->disable();
|
||||
|
||||
_compaction_state.erase(&t);
|
||||
|
||||
#ifdef DEBUG
|
||||
auto found = false;
|
||||
sstring msg;
|
||||
|
||||
Reference in New Issue
Block a user