-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
move dump stats to a separate thread #4382
Changes from 1 commit
3105c30
fe887bc
6e90ec4
08d7efc
c071d5b
6f4436f
7236bf5
7ad5d45
7fa6a49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,6 +514,30 @@ TEST_F(DBOptionsTest, SetStatsDumpPeriodSec) { | |
} | ||
} | ||
|
||
TEST_F(DBOptionsTest, RunStatsDumpPeriodSec) { | ||
Options options; | ||
options.create_if_missing = true; | ||
options.stats_dump_period_sec = 5; | ||
options.env = env_; | ||
int counter = 0; | ||
rocksdb::SyncPoint::GetInstance()->SetCallBack( | ||
"DBImpl::DumpStats:1", [&](void* /*arg*/) { | ||
counter++; | ||
}); | ||
rocksdb::SyncPoint::GetInstance()->EnableProcessing(); | ||
Reopen(options); | ||
ASSERT_EQ(5, dbfull()->GetDBOptions().stats_dump_period_sec); | ||
env_->SleepForMicroseconds(6000000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be flaky to rely on |
||
ASSERT_GE(counter, 1); | ||
|
||
// Test cacel job through SetOptions | ||
ASSERT_OK(dbfull()->SetDBOptions( | ||
{{"stats_dump_period_sec", "0"}})); | ||
int old_val = counter; | ||
env_->SleepForMicroseconds(10000000); | ||
ASSERT_EQ(counter, old_val); | ||
} | ||
|
||
static void assert_candidate_files_empty(DBImpl* dbfull, const bool empty) { | ||
dbfull->TEST_LockMutex(); | ||
JobContext job_context(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.
nit: The logic can be simplified as