Skip to content
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

Invoke GetOptionsFromString() in db_stress #10375

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,28 @@ void StressTest::PreloadDbAndReopenAsReadOnly(int64_t number_of_keys,

Status StressTest::SetOptions(ThreadState* thread) {
assert(FLAGS_set_options_one_in > 0);
#ifndef ROCKSDB_LITE
// `GetOptionsFromString()` is not supported in LITE mode.
if (thread->rand.Next() % 4 == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can use OneInOpt() or OneIn()

// Configuring an options structure can reprepare its member option objects
// that are not explicitly changed. Cover that here with 1/4 chance. If this
// behavior changes in the future we can remove this.
Options copy_options(options_);
return GetOptionsFromString(options_, "", &copy_options);
}
#endif // ROCKSDB_LITE
if (options_.rate_limiter != nullptr && thread->rand.Next() % 16 == 0) {
// When rate_limiter is enabled, cover `SetBytesPerSecond()` with 1/16
// chance.
if (thread->rand.Next() % 2 == 0) {
options_.rate_limiter->SetBytesPerSecond(FLAGS_rate_limiter_bytes_per_sec
<< 1);
} else {
options_.rate_limiter->SetBytesPerSecond(
FLAGS_rate_limiter_bytes_per_sec >> 1);
}
return Status::OK();
}
std::unordered_map<std::string, std::string> opts;
std::string name =
options_index_[thread->rand.Next() % options_index_.size()];
Expand Down