@ -2018,8 +2018,9 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
// FLUSH preempts compaction
// If there are no flush threads, then compaction thread needs to execute the
// TODO(icanadi) we should only do this if max_background_flushes == 0
// flushes
if ( db_options_ . max_background_flushes = = 0 ) {
// BackgroundFlush() will only execute a single flush. We keep calling it as
// BackgroundFlush() will only execute a single flush. We keep calling it as
// long as there's more flushes to be done
// long as there's more flushes to be done
while ( ! flush_queue_ . empty ( ) ) {
while ( ! flush_queue_ . empty ( ) ) {
@ -2029,7 +2030,8 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
" %d, compaction slots available %d " ,
" %d, compaction slots available %d " ,
db_options_ . max_background_flushes - bg_flush_scheduled_ ,
db_options_ . max_background_flushes - bg_flush_scheduled_ ,
db_options_ . max_background_compactions - bg_compaction_scheduled_ ) ;
db_options_ . max_background_compactions - bg_compaction_scheduled_ ) ;
auto flush_status = BackgroundFlush ( madeProgress , job_context , log_buffer ) ;
auto flush_status =
BackgroundFlush ( madeProgress , job_context , log_buffer ) ;
if ( ! flush_status . ok ( ) ) {
if ( ! flush_status . ok ( ) ) {
if ( is_manual ) {
if ( is_manual ) {
manual_compaction_ - > status = flush_status ;
manual_compaction_ - > status = flush_status ;
@ -2040,6 +2042,7 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context,
return flush_status ;
return flush_status ;
}
}
}
}
}
unique_ptr < Compaction > c ;
unique_ptr < Compaction > c ;
InternalKey manual_end_storage ;
InternalKey manual_end_storage ;