-
Notifications
You must be signed in to change notification settings - Fork 74
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
db bench: usability of the pinning policy parameter #720
db bench: usability of the pinning policy parameter #720
Conversation
5470540
to
64dc9ed
Compare
64dc9ed
to
6ceb098
Compare
tools/db_bench_tool.cc
Outdated
@@ -818,7 +819,27 @@ DEFINE_bool( | |||
" Note `cache_index_and_filter_blocks` must be true for this option to have" | |||
" any effect."); | |||
|
|||
DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy"); | |||
DEFINE_bool(scoped_pinning_policy, false, "Use Speedb's Scoped Pinning Policy"); |
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.
Can we please leave this as a string? Boolean parameters make it much harder to do validation and more alternatives.
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 string could be compared to the kClassName or the like...
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 whole point was to make it easy for users such as @erez-speedb to command db_bench to use scoped pinning policy. A boolean achieves just that. The whole point of this PR is usability and making the lives of the user easy.
And what validations are you referring to in this context?
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.
If we add a third pinning policy and the value is a boolean, then you can only set one of the booleans. A string is simpler and more expandable/adaptable. Look at the code for handling different Envs to see an example.
I believe the problem before was the string that was required was too complex. This code simplifies the string (and provides validation) by separating the fields that were in one string into multiple parameters.
And is it really that much harder to say --pinning_policy=scoped than --scoped_pinning_policy?
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 have reverted it to a string but the values are NOT the Class names (which are long and hard to remember. @erez-speedb complained about the length of the command line as it is).
The values (at the moment are: "default" and "scoped")
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 strongly suggest making the values class names and changing the class name if you do not like it. Using name/nickname of "scoped" seems very reasonable to me. The MergeOperators with names like "MergeSortOperator" and "sortlist" are great examples of names and nicknames that make sense
if (FLAGS_cost_write_buffer_to_cache) { | ||
if (FLAGS_db_write_buffer_size > FLAGS_cache_size) { | ||
ErrorExit("--cache_size must be >= --db_write_buffer_size"); | ||
} |
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.
What does this have to do with the pinning policy?
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.
Indirectly. These flags are used later in the calculation of the pinnning capacity.
ValidateMetadataCacheOptions(); | ||
ValidatePinningRelatedOptions(); |
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.
Aren't these two mutually exclusive? The MetadataCacheOptions are not used if PinningRelatedOptions are used
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.
Not necessarily. When using the default policy ValidateMetadataCacheOptions is applicable. Each one specific flags and their inter-dependencies.
What do you propose instead?
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.
Are the MetadataCacheOptions validation a problem with db_bench or the code in general?
I guess leave it for now. Not worth the hassle.
// | ||
class ScopedPinningPolicy : public RecordingPinningPolicy { | ||
public: | ||
ScopedPinningPolicy(); | ||
ScopedPinningPolicy(const ScopedPinningOptions& options); | ||
|
||
static const char* kClassName() { return "speedb_scoped_pinning_policy"; } | ||
static const char* kNickName() { return "speedb.ScopedPinningPolicy"; } |
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 am fine with the name "ScopedPinning" but "Scoped" or "scoped" would be acceptable too. The fact the class is PinningPolicy implies "Pinning"
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.
Done
@@ -890,7 +891,12 @@ DEFINE_string(fs_uri, "", | |||
" with --env_uri." | |||
" Creates a default environment with the specified filesystem."); | |||
|
|||
DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy"); | |||
DEFINE_string(pinning_policy, | |||
ROCKSDB_NAMESPACE::DefaultPinningPolicy::kNickName(), |
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 leave empty be the default?
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.
Allows the user to clearly see the actual pinning policy used by default.
Please see also my answer to your comment below.
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.
Setting this to a legal value rather than empty makes it much harder to tell if it is updated. If it is empty, then the system will use default. If not, it should use the one that is set.
"The options are: " | ||
"'DefaultPinning': Default RocksDB's pinning polcy. " | ||
"'ScopedPinning': Speedb's Scoped pinning policy."); |
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 explicitly state what the options are? If more were added via a plugin, this would be wrong. It also makes it hard to maintain.
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.
Obviously, however, the top priority here IMO is to make it easy for the users (and seeing the strings to use does just that). That is a purpose of a help string.
Adding a new policy is a rare event. Such a policy would probably have its own set of configuration flags that should be added anyway to db_bench, so, I believe that the developer adding the policy would update the help string / default if necessary.
@mrambacher - I have pushed another commit. Hopefully the last one. Please see if there is anything that you really think is important enough. Otherwise, please approve. Thanks |
@udi-speedb note that theres a conflict |
Thanks. Resolved |
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.
thanks
@@ -890,7 +891,12 @@ DEFINE_string(fs_uri, "", | |||
" with --env_uri." | |||
" Creates a default environment with the specified filesystem."); | |||
|
|||
DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy"); | |||
DEFINE_string(pinning_policy, | |||
ROCKSDB_NAMESPACE::DefaultPinningPolicy::kNickName(), |
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.
Setting this to a legal value rather than empty makes it much harder to tell if it is updated. If it is empty, then the system will use default. If not, it should use the one that is set.
…y-of-the-pinning-policy-parameter
6f5965d
to
52156ff
Compare
No description provided.