@ -1776,7 +1776,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
// max_background_compactions hasn't been reached and, in case
// max_background_compactions hasn't been reached and, in case
// bg_manual_only_ > 0, if it's a manual compaction.
// bg_manual_only_ > 0, if it's a manual compaction.
if ( ( manual_compaction_ | |
if ( ( manual_compaction_ | |
versions_ - > NeedsCompaction ( ) | |
versions_ - > current ( ) - > NeedsCompaction ( ) | |
( is_flush_pending & & ( options_ . max_background_flushes < = 0 ) ) ) & &
( is_flush_pending & & ( options_ . max_background_flushes < = 0 ) ) ) & &
bg_compaction_scheduled_ < options_ . max_background_compactions & &
bg_compaction_scheduled_ < options_ . max_background_compactions & &
( ! bg_manual_only_ | | manual_compaction_ ) ) {
( ! bg_manual_only_ | | manual_compaction_ ) ) {
@ -3350,12 +3350,11 @@ Status DBImpl::MakeRoomForWrite(bool force,
RecordTick ( options_ . statistics . get ( ) , STALL_L0_NUM_FILES_MICROS , stall ) ;
RecordTick ( options_ . statistics . get ( ) , STALL_L0_NUM_FILES_MICROS , stall ) ;
stall_level0_num_files_ + = stall ;
stall_level0_num_files_ + = stall ;
stall_level0_num_files_count_ + + ;
stall_level0_num_files_count_ + + ;
} else if (
} else if ( allow_hard_rate_limit_delay & & options_ . hard_rate_limit > 1.0 & &
allow_hard_rate_limit_delay & &
( score = versions_ - > current ( ) - > MaxCompactionScore ( ) ) >
options_ . hard_rate_limit > 1.0 & &
options_ . hard_rate_limit ) {
( score = versions_ - > MaxCompactionScore ( ) ) > options_ . hard_rate_limit ) {
// Delay a write when the compaction score for any level is too large.
// Delay a write when the compaction score for any level is too large.
int max_level = versions_ - > MaxCompactionScoreLevel ( ) ;
int max_level = versions_ - > current ( ) - > MaxCompactionScoreLevel ( ) ;
mutex_ . Unlock ( ) ;
mutex_ . Unlock ( ) ;
uint64_t delayed ;
uint64_t delayed ;
{
{
@ -3377,10 +3376,9 @@ Status DBImpl::MakeRoomForWrite(bool force,
allow_hard_rate_limit_delay = false ;
allow_hard_rate_limit_delay = false ;
}
}
mutex_ . Lock ( ) ;
mutex_ . Lock ( ) ;
} else if (
} else if ( allow_soft_rate_limit_delay & & options_ . soft_rate_limit > 0.0 & &
allow_soft_rate_limit_delay & &
( score = versions_ - > current ( ) - > MaxCompactionScore ( ) ) >
options_ . soft_rate_limit > 0.0 & &
options_ . soft_rate_limit ) {
( score = versions_ - > MaxCompactionScore ( ) ) > options_ . soft_rate_limit ) {
// Delay a write when the compaction score for any level is too large.
// Delay a write when the compaction score for any level is too large.
// TODO: add statistics
// TODO: add statistics
mutex_ . Unlock ( ) ;
mutex_ . Unlock ( ) ;