diff --git a/table/block_based/block_prefetcher.cc b/table/block_based/block_prefetcher.cc index 218d3821f56..19810cc6c33 100644 --- a/table/block_based/block_prefetcher.cc +++ b/table/block_based/block_prefetcher.cc @@ -20,7 +20,7 @@ void BlockPrefetcher::PrefetchIfNeeded( const size_t len = BlockBasedTable::BlockSizeWithTrailer(handle); const size_t offset = handle.offset(); if (is_for_compaction) { - if (!rep->file->use_direct_io()) { + if (!rep->file->use_direct_io() && compaction_readahead_size_ > 0) { // If FS supports prefetching (readahead_limit_ will be non zero in that // case) and current block exists in prefetch buffer then return. if (offset + len <= readahead_limit_) { diff --git a/unreleased_history/behavior_changes/no_fs_prefetch_on_zero_compaction_readahead.md b/unreleased_history/behavior_changes/no_fs_prefetch_on_zero_compaction_readahead.md new file mode 100644 index 00000000000..e09f693ef59 --- /dev/null +++ b/unreleased_history/behavior_changes/no_fs_prefetch_on_zero_compaction_readahead.md @@ -0,0 +1 @@ +For non direct IO, eliminate the file system prefetching attempt for compaction read when `Options::compaction_readahead_size` is 0