database: trigger compaction on boot

At the moment, we only trigger compaction after creating a new
sstable as a result of memtable flush, or some other event such
as changing compaction strategy of a column family.
However, it's important to trigger compaction on boot too.
That will happen after loading all column families.

Fixes #1404.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <54d38a418157454eec97aaba6b8a6b6e51484db4.1467135349.git.raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2016-06-28 14:35:59 -03:00
committed by Avi Kivity
parent 610fe274fd
commit 85cb2a6d35

View File

@@ -530,11 +530,13 @@ int main(int ac, char** av) {
// start thse compactions now. Note we start compacting only after
// all sstables in this CF were loaded on all shards - otherwise
// we will have races between the compaction and loading processes
// We also want to trigger regular compaction on boot.
db.invoke_on_all([&proxy] (database& db) {
for (auto& x : db.get_column_families()) {
column_family& cf = *(x.second);
// We start the rewrite, but do not wait for it.
cf.start_rewrite();
cf.trigger_compaction();
}
}).get();
supervisor_notify("setting up system keyspace");