Skip to content

Commit

Permalink
schema: max and min index interval
Browse files Browse the repository at this point in the history
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
  • Loading branch information
glommer committed Jul 10, 2015
1 parent aa270a1 commit ea17f6d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
11 changes: 9 additions & 2 deletions cql3/statements/cf_prop_defs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,16 @@ public:
cfm.defaultTimeToLive(getInt(KW_DEFAULT_TIME_TO_LIVE, cfm.getDefaultTimeToLive()));
cfm.speculativeRetry(CFMetaData.SpeculativeRetry.fromString(getString(KW_SPECULATIVE_RETRY, cfm.getSpeculativeRetry().toString())));
cfm.memtableFlushPeriod(getInt(KW_MEMTABLE_FLUSH_PERIOD, cfm.getMemtableFlushPeriod()));
cfm.minIndexInterval(getInt(KW_MIN_INDEX_INTERVAL, cfm.getMinIndexInterval()));
cfm.maxIndexInterval(getInt(KW_MAX_INDEX_INTERVAL, cfm.getMaxIndexInterval()));
#endif
if (has_property(KW_MIN_INDEX_INTERVAL)) {
builder.set_min_index_interval(get_int(KW_MIN_INDEX_INTERVAL, builder.get_min_index_interval()));
}

if (has_property(KW_MAX_INDEX_INTERVAL)) {
builder.set_max_index_interval(get_int(KW_MAX_INDEX_INTERVAL, builder.get_max_index_interval()));
}

#if 0
if (compactionStrategyClass != null)
{
cfm.compactionStrategyClass(compactionStrategyClass);
Expand Down
16 changes: 9 additions & 7 deletions db/legacy_schema_tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,10 @@ future<> save_system_keyspace_schema() {
m.set_clustered_cell(ckey, "local_read_repair_chance", table->dc_local_read_repair_chance(), timestamp);
m.set_clustered_cell(ckey, "min_compaction_threshold", table->min_compaction_threshold(), timestamp);
m.set_clustered_cell(ckey, "max_compaction_threshold", table->max_compaction_threshold(), timestamp);
m.set_clustered_cell(ckey, "min_index_interval", table->min_index_interval(), timestamp);
m.set_clustered_cell(ckey, "max_index_interval", table->max_index_interval(), timestamp);
#if 0
adder.add("max_index_interval", table.getMaxIndexInterval());
adder.add("memtable_flush_period_in_ms", table.getMemtableFlushPeriod());
adder.add("min_index_interval", table.getMinIndexInterval());
adder.add("read_repair_chance", table.getReadRepairChance());
adder.add("speculative_retry", table.getSpeculativeRetry().toString());

Expand Down Expand Up @@ -1298,13 +1298,15 @@ future<> save_system_keyspace_schema() {
builder.set_compressor_params(cp);
#if 0
cfm.compactionStrategyOptions(fromJsonMap(result.getString("compaction_strategy_options")));
#endif

if (result.has("min_index_interval"))
cfm.minIndexInterval(result.getInt("min_index_interval"));
if (table_row.has("min_index_interval")) {
builder.set_min_index_interval(table_row.get_nonnull<int>("min_index_interval"));
}

if (result.has("max_index_interval"))
cfm.maxIndexInterval(result.getInt("max_index_interval"));
#endif
if (table_row.has("max_index_interval")) {
builder.set_max_index_interval(table_row.get_nonnull<int>("max_index_interval"));
}

if (table_row.has("bloom_filter_fp_chance")) {
builder.set_bloom_filter_fp_chance(table_row.get_nonnull<double>("bloom_filter_fp_chance"));
Expand Down
10 changes: 10 additions & 0 deletions schema.hh
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ private:
double _dc_local_read_repair_chance = 0.1;
int32_t _min_compaction_threshold = 4;
int32_t _max_compaction_threshold = 32;
int32_t _min_index_interval = 128;
int32_t _max_index_interval = 2048;
};
raw_schema _raw;
thrift_schema _thrift;
Expand Down Expand Up @@ -288,6 +290,14 @@ public:
return _raw._max_compaction_threshold;
}

int32_t min_index_interval() const {
return _raw._min_index_interval;
}

int32_t max_index_interval() const {
return _raw._max_index_interval;
}

const column_definition* get_column_definition(const bytes& name) const;
const_iterator regular_begin() const {
return regular_columns().begin();
Expand Down
16 changes: 16 additions & 0 deletions schema_builder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ public:
return _raw._max_compaction_threshold;
}

void set_min_index_interval(int32_t t) {
_raw._min_index_interval = t;
}

int32_t get_min_index_interval() {
return _raw._min_index_interval;
}

void set_max_index_interval(int32_t t) {
_raw._max_index_interval = t;
}

int32_t get_max_index_interval() {
return _raw._max_index_interval;
}

void set_bloom_filter_fp_chance(double fp) {
_raw._bloom_filter_fp_chance = fp;
}
Expand Down

0 comments on commit ea17f6d

Please sign in to comment.