Skip to content

Commit 6d83a75

Browse files
anand1976facebook-github-bot
authored andcommitted
Pass FileSystem pointer and FileOptions to ExternalTableReader (#13551)
Summary: Pull Request resolved: #13551 Reviewed By: jaykorean Differential Revision: D73157052 Pulled By: anand1976 fbshipit-source-id: 580a9104a86b11e3b0b624bb8aa2cf176dc7a27a
1 parent 31b2397 commit 6d83a75

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

include/rocksdb/external_table.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "rocksdb/advanced_iterator.h"
99
#include "rocksdb/customizable.h"
1010
#include "rocksdb/file_checksum.h"
11+
#include "rocksdb/file_system.h"
1112
#include "rocksdb/iterator_base.h"
1213
#include "rocksdb/options.h"
1314
#include "rocksdb/status.h"
@@ -196,11 +197,17 @@ class ExternalTableBuilder {
196197
struct ExternalTableOptions {
197198
const std::shared_ptr<const SliceTransform>& prefix_extractor;
198199
const Comparator* comparator;
200+
const std::shared_ptr<FileSystem>& fs;
201+
const FileOptions& file_options;
199202

200203
ExternalTableOptions(
201204
const std::shared_ptr<const SliceTransform>& _prefix_extractor,
202-
const Comparator* _comparator)
203-
: prefix_extractor(_prefix_extractor), comparator(_comparator) {}
205+
const Comparator* _comparator, const std::shared_ptr<FileSystem>& _fs,
206+
const FileOptions& _file_options)
207+
: prefix_extractor(_prefix_extractor),
208+
comparator(_comparator),
209+
fs(_fs),
210+
file_options(_file_options) {}
204211
};
205212

206213
struct ExternalTableBuilderOptions {

table/external_table.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ class ExternalTableFactoryAdapter : public TableFactory {
287287
std::unique_ptr<TableReader>* table_reader,
288288
bool /* prefetch_index_and_filter_in_cache */) const override {
289289
std::unique_ptr<ExternalTableReader> reader;
290-
ExternalTableOptions ext_topts(topts.prefix_extractor,
291-
topts.ioptions.user_comparator);
290+
ExternalTableOptions ext_topts(
291+
topts.prefix_extractor, topts.ioptions.user_comparator,
292+
topts.ioptions.fs, FileOptions(topts.env_options));
292293
auto status =
293294
inner_->NewTableReader(ro, file->file_name(), ext_topts, &reader);
294295
if (!status.ok()) {

table/table_test.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -6882,7 +6882,10 @@ TEST_F(ExternalTableReaderTest, BasicTest) {
68826882
std::unique_ptr<ExternalTableReader> reader;
68836883
std::shared_ptr<SliceTransform> prefix_extractor;
68846884
ASSERT_OK(factory->NewTableReader(
6885-
{}, file_path, ExternalTableOptions(prefix_extractor, nullptr), &reader));
6885+
{}, file_path,
6886+
ExternalTableOptions(prefix_extractor, /*comparator=*/nullptr,
6887+
/*fs=*/nullptr, FileOptions()),
6888+
&reader));
68866889

68876890
ReadOptions ro;
68886891
std::unique_ptr<ExternalTableIterator> iter(reader->NewIterator(ro, nullptr));

0 commit comments

Comments
 (0)