Skip to content

Commit

Permalink
replica/database: quiesce compaction before closing system tables dur…
Browse files Browse the repository at this point in the history
…ing shutdown

During shutdown, as all system tables are closed in parallel, there is a
possibility of a race condition between compaction stoppage and the
closure of the compaction_history table. So, quiesce all the compaction
tasks before attempting to close the tables.

Fixes #15721

Signed-off-by: Lakshmi Narayanan Sreethar <lakshmi.sreethar@scylladb.com>

Closes #17218

(cherry picked from commit 3b7b315)
  • Loading branch information
lkshminarayanan authored and denesb committed Feb 19, 2024
1 parent b2fe98b commit 46098c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions replica/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,10 @@ future<> database::shutdown() {
co_await _stop_barrier.arrive_and_wait();
b.cancel();

// stop compaction across all shards before closing tables
co_await _compaction_manager.drain();
co_await _stop_barrier.arrive_and_wait();

// Closing a table can cause us to find a large partition. Since we want to record that, we have to close
// system.large_partitions after the regular tables.
co_await close_tables(database::table_kind::user);
Expand Down

0 comments on commit 46098c5

Please sign in to comment.