Disable PeriodicWorkScheduler during RateLimited test (#7810)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7810 Reviewed By: akankshamahajan15 Differential Revision: D25695454 Pulled By: jay-zhuang fbshipit-source-id: 963d11f38a959de7227ba2be15795af2792413a6
This commit is contained in:
parent
fdbebdf484
commit
77b4bfe511
@ -703,6 +703,18 @@ void DBImpl::PrintStatistics() {
|
|||||||
|
|
||||||
void DBImpl::StartPeriodicWorkScheduler() {
|
void DBImpl::StartPeriodicWorkScheduler() {
|
||||||
#ifndef ROCKSDB_LITE
|
#ifndef ROCKSDB_LITE
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
// It only used by test to disable scheduler
|
||||||
|
bool disable_scheduler = false;
|
||||||
|
TEST_SYNC_POINT_CALLBACK(
|
||||||
|
"DBImpl::StartPeriodicWorkScheduler:DisableScheduler",
|
||||||
|
&disable_scheduler);
|
||||||
|
if (disable_scheduler) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif // !NDEBUG
|
||||||
|
|
||||||
{
|
{
|
||||||
InstrumentedMutexLock l(&mutex_);
|
InstrumentedMutexLock l(&mutex_);
|
||||||
periodic_work_scheduler_ = PeriodicWorkScheduler::Default();
|
periodic_work_scheduler_ = PeriodicWorkScheduler::Default();
|
||||||
|
@ -374,6 +374,14 @@ TEST_F(DBSSTTest, RateLimitedDelete) {
|
|||||||
*abs_time_us = Env::Default()->NowMicros();
|
*abs_time_us = Env::Default()->NowMicros();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disable PeriodicWorkScheduler as it also has TimedWait, which could update
|
||||||
|
// the simulated sleep time
|
||||||
|
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack(
|
||||||
|
"DBImpl::StartPeriodicWorkScheduler:DisableScheduler", [&](void* arg) {
|
||||||
|
bool* disable_scheduler = static_cast<bool*>(arg);
|
||||||
|
*disable_scheduler = true;
|
||||||
|
});
|
||||||
|
|
||||||
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing();
|
||||||
|
|
||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
|
Loading…
Reference in New Issue
Block a user