db: compaction strategy changes via alter table must have immediate effect

At the moment, compaction strategy changes via ALTER TABLE have no effect until
node restart.

Tomek says: "Statements of the following form should have immediate effect:
ALTER TABLE t WITH compaction = { 'class' : 'LeveledCompactionStrategy' };"

Fixes #877.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <3b72c494f887643b82a272ef0a9995edb970382c.1464726828.git.raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2016-05-31 18:53:29 -03:00
committed by Tomasz Grabiec
parent d03f65d94e
commit 3f4500cb71

View File

@@ -1097,6 +1097,7 @@ future<> column_family::run_compaction(sstables::compaction_descriptor descripto
}
void column_family::set_compaction_strategy(sstables::compaction_strategy_type strategy) {
dblog.info("Setting compaction strategy of {}.{} to {}", _schema->ks_name(), _schema->cf_name(), sstables::compaction_strategy::name(strategy));
_compaction_strategy = make_compaction_strategy(strategy, _schema->compaction_strategy_options());
}
@@ -2726,4 +2727,7 @@ void column_family::set_schema(schema_ptr s) {
_cache.set_schema(s);
_schema = std::move(s);
set_compaction_strategy(_schema->compaction_strategy());
trigger_compaction();
}