New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate compaction strategy option values #2336
Comments
@raphaelsc can you provide a list of valid values? |
@tzach I sent a patch to the mailing list validating:
On top of that, we should probably have per-compaction-strategy validation to CS-specific options / semantics. |
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: scylladb#2336
@Deexie can you please pick this up? |
What we want is each compaction strategy to validate the |
LCS and TWCS have an attribute:
Are the following constraints exhaustive and strict enough? Common options:
Size Tiered Compaction Strategy:
Leveled Compaction Strategy:
For Time Window Compaction Strategy checks are already done. (Docs of all strategies and their options: https://github.com/scylladb/scylladb/blob/master/docs/cql/compaction.rst) Do we want to do the checks for Date-tiered Compaction Strategy (it's deprecated)? |
@raphaelsc ☝️ |
ping @raphaelsc please confirm #2336 (comment) |
please check check_restricted_table_properties() in cql3/statements/create_table_statements.cc. It currently performs some validation, and we should call strategy-specific validation from there. All strategies inherit common strategy options (tombstone_threshold, etc), see: compaction_strategy_impl in compaction/compaction_strategy_impl.hh . I suggest adding a validate(options) method to compaction_strategy_impl class. the options can be retrieved via schema->compaction_strategy_options(). Then we'd do the same for size_tiered_compaction_strategy. Add a validate(options) method to it, which in turn calls compaction_strategy_impl::validate(options), and performs validation on STCS options. The same logic applies to LCS and TWCS, where both inherit STCS options. DTCS is deprecated, we can just ignore it. |
@Deexie ping |
Only affects invalid DDL input, not backporting. |
Compaction strategy option value should be validated when either creating or altering a column family's schema. A bad value can lead the strategy to behave very badly.
The text was updated successfully, but these errors were encountered: