db: stop the compaction manager earlier

We want to finish all large data logging in stop_system, so stopping
the compaction manager should be the first thing stop_system does.

The make_ready_future<>() will be removed in a followup patch.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
This commit is contained in:
Rafael Ávila de Espíndola
2019-03-01 12:05:40 -08:00
parent 765d8535f1
commit a3e1f14134

View File

@@ -1641,7 +1641,11 @@ schema_ptr database::find_indexed_table(const sstring& ks_name, const sstring& i
future<> stop_database(sharded<database>& sdb) {
return sdb.invoke_on_all([](database& db) {
db.stop_large_data_handler();
return db.get_compaction_manager().stop();
}).then([&sdb] {
return sdb.invoke_on_all([](database& db) {
db.stop_large_data_handler();
});
});
}
@@ -1650,14 +1654,11 @@ void database::stop_large_data_handler() { _large_data_handler->stop(); }
future<>
database::stop() {
assert(_large_data_handler->stopped());
assert(_compaction_manager->stopped());
return _compaction_manager->stop().then([this] {
// try to ensure that CL has done disk flushing
if (_commitlog != nullptr) {
return _commitlog->shutdown();
}
return make_ready_future<>();
}).then([this] {
// try to ensure that CL has done disk flushing
future<> maybe_shutdown_commitlog = _commitlog != nullptr ? _commitlog->shutdown() : make_ready_future<>();
return maybe_shutdown_commitlog.then([this] {
return parallel_for_each(_column_families, [this] (auto& val_pair) {
return val_pair.second->stop();
});