compaction: Allow reshape to be aborted

Now reshape can be aborted on either boot or refresh.

The workflow is:
    1) reshape starts
    2) user notices it's taking too long
    3) nodetool stop RESHAPE

the good thing is that completed reshape work isn't lost, allowing
table to enjoy the benefits of all reshaping done up to the abortion
point.

Fixes #7738.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2021-07-28 11:32:31 -03:00
parent 33404b9169
commit aa7cdc0392
2 changed files with 8 additions and 1 deletions

View File

@@ -317,6 +317,7 @@ future<> compaction_manager::run_custom_job(column_family* cf, sstables::compact
f.get();
} catch (sstables::compaction_stop_exception& e) {
cmlog.info("{} was abruptly stopped, reason: {}", task->type, e.what());
throw;
} catch (...) {
cmlog.error("{} failed: {}", task->type, std::current_exception());
throw;

View File

@@ -362,7 +362,13 @@ future<uint64_t> sstable_directory::reshape(compaction_manager& cm, table& table
return collect_output_sstables_from_reshaping(std::move(new_sstables));
});
});
}).then([] {
}).then_wrapped([&table] (future<> f) {
try {
f.get();
} catch (sstables::compaction_stop_exception& e) {
dirlog.info("Table {}.{} with compaction strategy {} had reshape successfully aborted.", table.schema()->ks_name(), table.schema()->cf_name(), table.get_compaction_strategy().name());
return make_ready_future<stop_iteration>(stop_iteration::yes);
}
return make_ready_future<stop_iteration>(stop_iteration::no);
});
}).then([&reshaped_size] {