diff --git a/table/block_based/block_prefetcher.cc b/table/block_based/block_prefetcher.cc index 0af5abaf0..18b54c739 100644 --- a/table/block_based/block_prefetcher.cc +++ b/table/block_based/block_prefetcher.cc @@ -37,11 +37,12 @@ void BlockPrefetcher::PrefetchIfNeeded(const BlockBasedTable::Rep* rep, if (s.ok()) { readahead_limit_ = offset + len + compaction_readahead_size_; return; + } else if (!s.IsNotSupported()) { + return; } } // If FS prefetch is not supported, fall back to use internal prefetch - // buffer. Discarding other return status of Prefetch calls intentionally, - // as we can fallback to reading from disk if Prefetch fails. + // buffer. // // num_file_reads is used by FilePrefetchBuffer only when // implicit_auto_readahead is set. @@ -123,8 +124,6 @@ void BlockPrefetcher::PrefetchIfNeeded(const BlockBasedTable::Rep* rep, } // If prefetch is not supported, fall back to use internal prefetch buffer. - // Discarding other return status of Prefetch calls intentionally, as - // we can fallback to reading from disk if Prefetch fails. IOOptions opts; Status s = rep->file->PrepareIOOptions(read_options, opts); if (!s.ok()) { diff --git a/unreleased_history/bug_fixes/fallback_only_unsupported.md b/unreleased_history/bug_fixes/fallback_only_unsupported.md new file mode 100644 index 000000000..feb02ce3b --- /dev/null +++ b/unreleased_history/bug_fixes/fallback_only_unsupported.md @@ -0,0 +1 @@ +Fixed a bug where compaction read under non direct IO still falls back to RocksDB internal prefetching after file system's prefetching returns non-OK status other than `Status::NotSupported()`