From 979833d56d40f14d6177fed3f2d0a07c7a9daf8c Mon Sep 17 00:00:00 2001 From: Andrew Chang Date: Mon, 25 Nov 2024 11:10:39 -0800 Subject: [PATCH] Set fs constructor parameter for FilePrefetchBuffer --- table/block_based/block_based_table_reader.cc | 7 ++++--- table/block_based/block_based_table_reader.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/table/block_based/block_based_table_reader.cc b/table/block_based/block_based_table_reader.cc index 35d387ae9f1..8a3881d3882 100644 --- a/table/block_based/block_based_table_reader.cc +++ b/table/block_based/block_based_table_reader.cc @@ -660,7 +660,7 @@ Status BlockBasedTable::Open( const bool preload_all = !table_options.cache_index_and_filter_blocks; if (!ioptions.allow_mmap_reads && !env_options.use_mmap_reads) { - s = PrefetchTail(ro, file.get(), file_size, force_direct_prefetch, + s = PrefetchTail(ro, ioptions, file.get(), file_size, force_direct_prefetch, tail_prefetch_stats, prefetch_all, preload_all, &prefetch_buffer, ioptions.stats, tail_size, ioptions.logger); @@ -877,7 +877,8 @@ Status BlockBasedTable::Open( } Status BlockBasedTable::PrefetchTail( - const ReadOptions& ro, RandomAccessFileReader* file, uint64_t file_size, + const ReadOptions& ro, const ImmutableOptions& ioptions, + RandomAccessFileReader* file, uint64_t file_size, bool force_direct_prefetch, TailPrefetchStats* tail_prefetch_stats, const bool prefetch_all, const bool preload_all, std::unique_ptr* prefetch_buffer, Statistics* stats, @@ -948,7 +949,7 @@ Status BlockBasedTable::PrefetchTail( // Use `FilePrefetchBuffer` prefetch_buffer->reset(new FilePrefetchBuffer( ReadaheadParams(), true /* enable */, true /* track_min_offset */, - nullptr /* fs */, nullptr /* clock */, stats, + ioptions.fs.get() /* fs */, nullptr /* clock */, stats, /* readahead_cb */ nullptr, FilePrefetchBufferUsage::kTableOpenPrefetchTail)); diff --git a/table/block_based/block_based_table_reader.h b/table/block_based/block_based_table_reader.h index 34519f2572c..513e517aa85 100644 --- a/table/block_based/block_based_table_reader.h +++ b/table/block_based/block_based_table_reader.h @@ -482,7 +482,8 @@ class BlockBasedTable : public TableReader { // If force_direct_prefetch is true, always prefetching to RocksDB // buffer, rather than calling RandomAccessFile::Prefetch(). static Status PrefetchTail( - const ReadOptions& ro, RandomAccessFileReader* file, uint64_t file_size, + const ReadOptions& ro, const ImmutableOptions& ioptions, + RandomAccessFileReader* file, uint64_t file_size, bool force_direct_prefetch, TailPrefetchStats* tail_prefetch_stats, const bool prefetch_all, const bool preload_all, std::unique_ptr* prefetch_buffer, Statistics* stats,