@ -356,37 +356,25 @@ TEST_F(DBSSTTest, RateLimitedDelete) {
" InstrumentedCondVar::TimedWaitInternal " , [ & ] ( void * arg ) {
" InstrumentedCondVar::TimedWaitInternal " , [ & ] ( void * arg ) {
// Turn timed wait into a simulated sleep
// Turn timed wait into a simulated sleep
uint64_t * abs_time_us = static_cast < uint64_t * > ( arg ) ;
uint64_t * abs_time_us = static_cast < uint64_t * > ( arg ) ;
int64_t cur_time = 0 ;
uint64_t cur_time = env_ - > NowMicros ( ) ;
env_ - > GetCurrentTime ( & cur_time ) ;
if ( * abs_time_us > cur_time ) {
if ( * abs_time_us > static_cast < uint64_t > ( cur_time ) ) {
env_ - > addon_time_ . fetch_add ( * abs_time_us - cur_time ) ;
env_ - > addon_time_ . fetch_add ( * abs_time_us -
static_cast < uint64_t > ( cur_time ) ) ;
}
}
// Randomly sleep shortly
// Randomly sleep shortly
env_ - > addon_time_ . fetch_add (
env_ - > addon_time_ . fetch_add (
static_cast < uint64_t > ( Random : : GetTLSInstance ( ) - > Uniform ( 10 ) ) ) ;
static_cast < uint64_t > ( Random : : GetTLSInstance ( ) - > Uniform ( 10 ) ) ) ;
// Set wait until time to before current to force not to sleep.
// Set wait until time to before (actual) current time to force not
int64_t real_cur_time = 0 ;
// to sleep
Env : : Default ( ) - > GetCurrentTime ( & real_cur_time ) ;
* abs_time_us = Env : : Default ( ) - > NowMicros ( ) ;
* abs_time_us = static_cast < uint64_t > ( real_cur_time ) ;
} ) ;
} ) ;
ROCKSDB_NAMESPACE : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
ROCKSDB_NAMESPACE : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
env_ - > no_slowdown_ = true ;
env_ - > time_elapse_only_sleep_ = true ;
Options options = CurrentOptions ( ) ;
Options options = CurrentOptions ( ) ;
env_ - > SetTimeElapseOnlySleep ( & options ) ;
options . disable_auto_compactions = true ;
options . disable_auto_compactions = true ;
// Need to disable stats dumping and persisting which also use
// RepeatableThread, one of whose member variables is of type
// InstrumentedCondVar. The callback for
// InstrumentedCondVar::TimedWaitInternal can be triggered by stats dumping
// and persisting threads and cause time_spent_deleting measurement to become
// incorrect.
options . stats_dump_period_sec = 0 ;
options . stats_persist_period_sec = 0 ;
options . env = env_ ;
options . env = env_ ;
int64_t rate_bytes_per_sec = 1024 * 10 ; // 10 Kbs / Sec
int64_t rate_bytes_per_sec = 1024 * 10 ; // 10 Kbs / Sec