-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 options #13956
Validate compaction strategy options #13956
Conversation
In draft since I am not sure if some options should be checked/allowed. Marked the places with comments above. |
@bhalevy @raphaelsc review please |
@bhalevy , @raphaelsc - ping for review (this is part of the quality improvement effort, so will be great to make progress on this) |
return window_unit; | ||
} | ||
|
||
int time_window_compaction_strategy_options::validate_compaction_window_size(const std::map<sstring, sstring>& options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's possible to pass a mutable std::map<sstring, sstring>& options
and to erase the relevant option once it's validated
so we can check at the end if there are unrecognized options that are left.
It's possible that due to a typo, the user means to set some options but the code doesn't recognize it and it might go unnoticed.
(I guess the "nested" size_tiered options will need to handled too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "nested" options are checked in the following commits. The whole validation has the structure:
validate_*
helpers validate a single option*_compaction_strategy_options::validate
validate options specific for the respective strategy (and use ^)compaction_strategy_impl::validate_options
validates options that are common for each strategy type*_compaction_strategy::validate_options
validate "nested" options for each strategy (and use ^ and ^^)
compaction/compaction_strategy.cc
Outdated
throw exceptions::syntax_exception(sstring("Invalid long value ") + tmp_value.value() + " for " + TOMBSTONE_COMPACTION_INTERVAL_OPTION); | ||
} | ||
|
||
if (interval <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not check tombstone_compaction_interval
?
can it become negative due to wrap around?
09a8103
to
5704326
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall.
I had one question regarding format
5704326
to
460b020
Compare
|
To summarize our 1:1 conversation regarding valid, yet unsupported options, we need to:
|
460b020
to
96b551c
Compare
|
|
CI state |
CI state |
It would be lovely to get this moving, since currently it is affecting CI-stability. |
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Add temporarily empty validate method to compaction_strategy_options. The method will validate the options and help determining whether only the allowed options were set.
Split time_window_compaction_strategy_options constructor into functions that will be reused for validation.
To be consistent with other compaction_strategy_options, time_window_compaction_strategy_options uses compaction_strategy_impl::get_value and cql3::statements::property_definitions::to_long helpers for parsing.
Split size_tiered_compaction_strategy_options constructor into methods that will be reused for validation. Add additional checks providing that options' values are legal.
Add compaction_strategy_impl::validate_min_max_threshold method that will be used to validate min and max threshold values for different compaction methods.
Split compaction_strategy_impl constructor into methods that will be reused for validation. Add additional checks providing that options' values are legal.
Add compaction_strategy_impl::validate_options to validate common compaction strategy options.
For each compaction strategy, validate whether options values are valid.
Check whether valid compaction strategy options are set for the given strategy type in check_restricted_table_properties.
Use fmt::format in exception messages in all methods validating compaction strategies.
18f5b84
to
14598fd
Compare
|
CI state |
Looks unrelated. test_fencing timing out in debug mode. |
CI state |
CI state |
@scylladb/scylla-maint please merge |
When a column family's schema is changed new compaction
strategy type may be applied.
To make sure that it will behave as expected, compaction
strategy need to contain only the allowed options and values.
Methods throwing exception on invalid options are added.
Fixes: #2336.