compaction_group::stop(): always call compaction_manager.remove()

Before introduction of PR#15524 the removal had always been invoked
via finally() continuation. In spite of making flush() noexcept, the
mentioned PR modified the logic. If flush() returns exceptional future,
then the removal is not performed.

This change restores the old behavior - removal operation is always called.
Since now, the logic of compaction_group::stop() is as follows:
 - firstly, it waits for completion of flush() via
   seastar::coroutine::as_future() to avoid premature exception
 - then it executes compaction_manager.remove()
 - in the end it inspects the future returned from flush()
   to re-throw the exception if the operation failed

Fixed: scylladb#16751

Signed-off-by: Patryk Wrobel <patryk.wrobel@scylladb.com>

Closes scylladb/scylladb#16940
This commit is contained in:
Patryk Wrobel
2024-01-23 12:01:56 +01:00
committed by Botond Dénes
parent 78ec96f5f3
commit f15880dc48

View File

@@ -1784,8 +1784,13 @@ future<> compaction_group::stop() noexcept {
co_return;
}
co_await _async_gate.close();
co_await flush();
auto flush_future = co_await seastar::coroutine::as_future(flush());
co_await _t._compaction_manager.remove(as_table_state());
if (flush_future.failed()) {
co_await seastar::coroutine::return_exception_ptr(flush_future.get_exception());
}
}
bool compaction_group::empty() const noexcept {