Skip to content

db bench: usability of the pinning policy parameter - #720

Merged
udi-speedb merged 8 commits into
mainfrom
687-db_bench-usability-of-the-pinning-policy-parameter
Oct 19, 2023
Merged

udi-speedb merged 8 commits into
mainfrom
687-db_bench-usability-of-the-pinning-policy-parameter

Conversation

@udi-speedb

Copy link
Copy Markdown
Contributor

No description provided.

@udi-speedb udi-speedb linked an issue Oct 16, 2023 that may be closed by this pull request
@udi-speedb
udi-speedb force-pushed the 687-db_bench-usability-of-the-pinning-policy-parameter branch from 5470540 to 64dc9ed Compare October 16, 2023 14:28
@udi-speedb
udi-speedb force-pushed the 687-db_bench-usability-of-the-pinning-policy-parameter branch from 64dc9ed to 6ceb098 Compare October 17, 2023 11:30
@Guyme
Guyme requested review from mrambacher and removed request for Yuval-Ariel October 17, 2023 12:15
Comment thread tools/db_bench_tool.cc Outdated
" any effect.");

DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy");
DEFINE_bool(scoped_pinning_policy, false, "Use Speedb's Scoped Pinning Policy");

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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...

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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")

Copy link
Copy Markdown
Contributor

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

Comment thread tools/db_bench_tool.cc
Comment on lines +9349 to +9352
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");
}

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

Comment thread tools/db_bench_tool.cc
Comment on lines 9673 to +9674
ValidateMetadataCacheOptions();
ValidatePinningRelatedOptions();

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Contributor

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.

@udi-speedb
udi-speedb requested a review from mrambacher October 18, 2023 15:40
ScopedPinningPolicy(const ScopedPinningOptions& options);

static const char* kClassName() { return "speedb_scoped_pinning_policy"; }
static const char* kNickName() { return "speedb.ScopedPinningPolicy"; }

Copy link
Copy Markdown
Contributor

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"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy");
DEFINE_string(pinning_policy,
ROCKSDB_NAMESPACE::DefaultPinningPolicy::kNickName(),

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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.

Comment on lines +897 to +899
"The options are: "
"'DefaultPinning': Default RocksDB's pinning polcy. "
"'ScopedPinning': Speedb's Scoped pinning policy.");

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@udi-speedb

Copy link
Copy Markdown
Contributor Author

@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

@Yuval-Ariel

Copy link
Copy Markdown
Contributor

@udi-speedb note that theres a conflict

@udi-speedb

Copy link
Copy Markdown
Contributor Author

@udi-speedb note that theres a conflict

Thanks. Resolved

@mrambacher mrambacher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks


DEFINE_string(pinning_policy, "", "URI for registry TablePinningPolicy");
DEFINE_string(pinning_policy,
ROCKSDB_NAMESPACE::DefaultPinningPolicy::kNickName(),

Copy link
Copy Markdown
Contributor

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.

@udi-speedb
udi-speedb force-pushed the 687-db_bench-usability-of-the-pinning-policy-parameter branch from 6f5965d to 52156ff Compare October 19, 2023 16:36
@udi-speedb
udi-speedb merged commit 8c68304 into main Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

db_bench usability of the pinning policy parameter

3 participants