mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
batchlog_manager: Fix drain() reentrability
Currently drain() is called twise -- first time from storage_service::drain() (on shutdown), second via batchlog_manager::stop(). The routine is unintentinally re-entrable, because: - explicit check for not aborting the abort source twise - breaking semaphore can be done multiple times - co-await-ing of the _started future works because the future is shared That's not extremely elegant, better to make the drain() bail out early if it was already called. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -115,10 +115,12 @@ future<> db::batchlog_manager::start() {
|
||||
}
|
||||
|
||||
future<> db::batchlog_manager::drain() {
|
||||
blogger.info("Asked to drain");
|
||||
if (!_stop.abort_requested()) {
|
||||
_stop.request_abort();
|
||||
if (_stop.abort_requested()) {
|
||||
co_return;
|
||||
}
|
||||
|
||||
blogger.info("Asked to drain");
|
||||
_stop.request_abort();
|
||||
if (this_shard_id() == 0) {
|
||||
// Abort do_batch_log_replay if waiting on the semaphore.
|
||||
_sem.broken();
|
||||
|
||||
Reference in New Issue
Block a user