Remove RandomAccessFileReader.for_compaction_ (#5572)

Summary:
RandomAccessFileReader.for_compaction_ doesn't seem to be used anymore. Remove it.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5572

Test Plan: USE_CLANG=1 make all check -j

Differential Revision: D16286178

fbshipit-source-id: aa338049761033dfbe5e8b1707bbb0be2df5be7e
This commit is contained in:
sdong 2019-07-16 16:27:32 -07:00 committed by Facebook Github Bot
parent 0acaa1a846
commit 699a569c52
5 changed files with 5 additions and 12 deletions

View file

@ -93,7 +93,7 @@ Status TableCache::GetTableReader(
bool sequential_mode, bool record_read_stats, HistogramImpl* file_read_hist, bool sequential_mode, bool record_read_stats, HistogramImpl* file_read_hist,
std::unique_ptr<TableReader>* table_reader, std::unique_ptr<TableReader>* table_reader,
const SliceTransform* prefix_extractor, bool skip_filters, int level, const SliceTransform* prefix_extractor, bool skip_filters, int level,
bool prefetch_index_and_filter_in_cache, bool for_compaction) { bool prefetch_index_and_filter_in_cache) {
std::string fname = std::string fname =
TableFileName(ioptions_.cf_paths, fd.GetNumber(), fd.GetPathId()); TableFileName(ioptions_.cf_paths, fd.GetNumber(), fd.GetPathId());
std::unique_ptr<RandomAccessFile> file; std::unique_ptr<RandomAccessFile> file;
@ -109,8 +109,7 @@ Status TableCache::GetTableReader(
new RandomAccessFileReader( new RandomAccessFileReader(
std::move(file), fname, ioptions_.env, std::move(file), fname, ioptions_.env,
record_read_stats ? ioptions_.statistics : nullptr, SST_READ_MICROS, record_read_stats ? ioptions_.statistics : nullptr, SST_READ_MICROS,
file_read_hist, ioptions_.rate_limiter, for_compaction, file_read_hist, ioptions_.rate_limiter, ioptions_.listeners));
ioptions_.listeners));
s = ioptions_.table_factory->NewTableReader( s = ioptions_.table_factory->NewTableReader(
TableReaderOptions(ioptions_, prefix_extractor, env_options, TableReaderOptions(ioptions_, prefix_extractor, env_options,
internal_comparator, skip_filters, immortal_tables_, internal_comparator, skip_filters, immortal_tables_,

View file

@ -179,8 +179,7 @@ class TableCache {
std::unique_ptr<TableReader>* table_reader, std::unique_ptr<TableReader>* table_reader,
const SliceTransform* prefix_extractor = nullptr, const SliceTransform* prefix_extractor = nullptr,
bool skip_filters = false, int level = -1, bool skip_filters = false, int level = -1,
bool prefetch_index_and_filter_in_cache = true, bool prefetch_index_and_filter_in_cache = true);
bool for_compaction = false);
const ImmutableCFOptions& ioptions_; const ImmutableCFOptions& ioptions_;
const EnvOptions& env_options_; const EnvOptions& env_options_;

View file

@ -1231,8 +1231,7 @@ Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
new RandomAccessFileReader( new RandomAccessFileReader(
std::move(file), file_name, nullptr /* env */, nullptr /* stats */, std::move(file), file_name, nullptr /* env */, nullptr /* stats */,
0 /* hist_type */, nullptr /* file_read_hist */, 0 /* hist_type */, nullptr /* file_read_hist */,
nullptr /* rate_limiter */, false /* for_compaction*/, nullptr /* rate_limiter */, ioptions->listeners));
ioptions->listeners));
s = ReadTableProperties( s = ReadTableProperties(
file_reader.get(), file_meta->fd.GetFileSize(), file_reader.get(), file_meta->fd.GetFileSize(),
Footer::kInvalidTableMagicNumber /* table's magic number */, *ioptions, Footer::kInvalidTableMagicNumber /* table's magic number */, *ioptions,

View file

@ -197,7 +197,6 @@ Status RandomAccessFileReader::MultiRead(ReadRequest* read_reqs,
Status s; Status s;
uint64_t elapsed = 0; uint64_t elapsed = 0;
assert(!use_direct_io()); assert(!use_direct_io());
assert(!for_compaction_);
{ {
StopWatch sw(env_, stats_, hist_type_, StopWatch sw(env_, stats_, hist_type_,
(stats_ != nullptr) ? &elapsed : nullptr, true /*overwrite*/, (stats_ != nullptr) ? &elapsed : nullptr, true /*overwrite*/,

View file

@ -108,7 +108,6 @@ class RandomAccessFileReader {
uint32_t hist_type_; uint32_t hist_type_;
HistogramImpl* file_read_hist_; HistogramImpl* file_read_hist_;
RateLimiter* rate_limiter_; RateLimiter* rate_limiter_;
bool for_compaction_;
std::vector<std::shared_ptr<EventListener>> listeners_; std::vector<std::shared_ptr<EventListener>> listeners_;
public: public:
@ -116,7 +115,7 @@ class RandomAccessFileReader {
std::unique_ptr<RandomAccessFile>&& raf, std::string _file_name, std::unique_ptr<RandomAccessFile>&& raf, std::string _file_name,
Env* env = nullptr, Statistics* stats = nullptr, uint32_t hist_type = 0, Env* env = nullptr, Statistics* stats = nullptr, uint32_t hist_type = 0,
HistogramImpl* file_read_hist = nullptr, HistogramImpl* file_read_hist = nullptr,
RateLimiter* rate_limiter = nullptr, bool for_compaction = false, RateLimiter* rate_limiter = nullptr,
const std::vector<std::shared_ptr<EventListener>>& listeners = {}) const std::vector<std::shared_ptr<EventListener>>& listeners = {})
: file_(std::move(raf)), : file_(std::move(raf)),
file_name_(std::move(_file_name)), file_name_(std::move(_file_name)),
@ -125,7 +124,6 @@ class RandomAccessFileReader {
hist_type_(hist_type), hist_type_(hist_type),
file_read_hist_(file_read_hist), file_read_hist_(file_read_hist),
rate_limiter_(rate_limiter), rate_limiter_(rate_limiter),
for_compaction_(for_compaction),
listeners_() { listeners_() {
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
std::for_each(listeners.begin(), listeners.end(), std::for_each(listeners.begin(), listeners.end(),
@ -151,7 +149,6 @@ class RandomAccessFileReader {
hist_type_ = std::move(o.hist_type_); hist_type_ = std::move(o.hist_type_);
file_read_hist_ = std::move(o.file_read_hist_); file_read_hist_ = std::move(o.file_read_hist_);
rate_limiter_ = std::move(o.rate_limiter_); rate_limiter_ = std::move(o.rate_limiter_);
for_compaction_ = std::move(o.for_compaction_);
return *this; return *this;
} }