cqlsh auto completion: refactor definition of compaction strategy options patch by Eduard Tudenhoefner; reviewed by Stefania Alborghetti for CASSANDRA-12946
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/68c828f4 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/68c828f4 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/68c828f4 Branch: refs/heads/trunk Commit: 68c828f48a2ba961bb8c9b99a6c57b76a3f16e3d Parents: 8884302 Author: Eduard Tudenhoefner <[email protected]> Authored: Wed Nov 23 09:17:26 2016 +0800 Committer: Stefania Alborghetti <[email protected]> Committed: Mon Nov 28 09:05:05 2016 +0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + pylib/cqlshlib/cql3handling.py | 47 ++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/68c828f4/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 3f47bab..32a3f32 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.12 + * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946) * Add support for arithmetic operators (CASSANDRA-11935) 3.11 http://git-wip-us.apache.org/repos/asf/cassandra/blob/68c828f4/pylib/cqlshlib/cql3handling.py ---------------------------------------------------------------------- diff --git a/pylib/cqlshlib/cql3handling.py b/pylib/cqlshlib/cql3handling.py index f759422..3c21bc8 100644 --- a/pylib/cqlshlib/cql3handling.py +++ b/pylib/cqlshlib/cql3handling.py @@ -79,6 +79,33 @@ class Cql3ParsingRuleSet(CqlParsingRuleSet): 'SERIAL' ) + size_tiered_compaction_strategy_options = ( + 'min_sstable_size', + 'min_threshold', + 'bucket_high', + 'bucket_low' + ) + + leveled_compaction_strategy_options = ( + 'sstable_size_in_mb', + 'fanout_size' + ) + + date_tiered_compaction_strategy_options = ( + 'base_time_seconds', + 'max_sstable_age_days', + 'min_threshold', + 'max_window_size_seconds', + 'timestamp_resolution' + ) + + time_window_compaction_strategy_options = ( + 'compaction_window_unit', + 'compaction_window_size', + 'min_threshold', + 'timestamp_resolution' + ) + @classmethod def escape_value(cls, value): if value is None: @@ -506,25 +533,13 @@ def cf_prop_val_mapkey_completer(ctxt, cass): return ["'class'"] csc = csc.split('.')[-1] if csc == 'SizeTieredCompactionStrategy': - opts.add('min_sstable_size') - opts.add('min_threshold') - opts.add('bucket_high') - opts.add('bucket_low') + opts = opts.union(set(CqlRuleSet.size_tiered_compaction_strategy_options)) elif csc == 'LeveledCompactionStrategy': - opts.add('sstable_size_in_mb') - opts.add('fanout_size') + opts = opts.union(set(CqlRuleSet.leveled_compaction_strategy_options)) elif csc == 'DateTieredCompactionStrategy': - opts.add('base_time_seconds') - opts.add('max_sstable_age_days') - opts.add('min_threshold') - opts.add('max_window_size_seconds') - opts.add('timestamp_resolution') + opts = opts.union(set(CqlRuleSet.date_tiered_compaction_strategy_options)) elif csc == 'TimeWindowCompactionStrategy': - opts.add('compaction_window_unit') - opts.add('compaction_window_size') - opts.add('min_threshold') - opts.add('max_threshold') - opts.add('timestamp_resolution') + opts = opts.union(set(CqlRuleSet.time_window_compaction_strategy_options)) return map(escape_value, opts) return ()
