Skip to content

Commit

Permalink
Only fallback to RocksDB internal prefetching on unsupported FS prefe…
Browse files Browse the repository at this point in the history
…tching (#11897)

Summary:
**Context/Summary:**
facebook/rocksdb#11631 introduced an undesired fallback behavior to RocksDB internal prefetching even when FS prefetching return non-OK status other than "Unsupported". We only want to fall back when FS prefetching is not supported.

Pull Request resolved: facebook/rocksdb#11897

Test Plan: CI

Reviewed By: ajkr

Differential Revision: D49667055

Pulled By: hx235

fbshipit-source-id: fa36e4e5d6dc9507080217035f9d6ff8e4abda28
  • Loading branch information
hx235 committed Sep 27, 2023
1 parent 347d8dd commit 27297d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions table/block_based/block_prefetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()) {
Expand Down
1 change: 1 addition & 0 deletions unreleased_history/bug_fixes/fallback_only_unsupported.md
Original file line number Diff line number Diff line change
@@ -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()`

0 comments on commit 27297d1

Please sign in to comment.