mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
time_window_compaction_strategy: reject invalid window_sizes
Scylla mistakenly allows an user to configure an invalid TWCS window_size <= 0, which effectively breaks the notion of compaction windows. Interestingly enough, a <= 0 window size should be considered an undefined behavior as either we would create a new window every 0 duration (?) or the table would behave as STCS, the reader is encouraged to figure out which one of these is true. :-) Cassandra, on the other hand, will properly throw a ConfigurationException when receiving such invalid window sizes and we now match the behavior to the same as Cassandra's. Refs: #2336
This commit is contained in:
@@ -43,6 +43,10 @@ time_window_compaction_strategy_options::time_window_compaction_strategy_options
|
||||
}
|
||||
}
|
||||
|
||||
if (window_size <= 0) {
|
||||
throw exceptions::configuration_exception(fmt::format("{} must be greater than 1 for compaction_window_size", window_size));
|
||||
}
|
||||
|
||||
sstable_window_size = window_size * window_unit;
|
||||
|
||||
it = options.find(EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY);
|
||||
|
||||
Reference in New Issue
Block a user