From d746eaad5ed990aaf796f72c6a2486d1db2a613c Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 22 Sep 2015 18:21:10 -0700 Subject: [PATCH] RandomAccessFileReader should not inherit RandomAccessFile Summary: RandomAccessFileReader unnecessarily inherited RandomAccessFile, which can introduce unnecessarily extra costs. Remove it. Test Plan: Run all existing tests Reviewers: yhchiang, anthony, igor, kradhakrishnan, rven, IslamAbdelRahman Reviewed By: IslamAbdelRahman Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D47409 --- table/block_based_table_reader.cc | 6 +++--- util/file_reader_writer.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index 08c3f2055..6ffb8280a 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -617,13 +617,13 @@ void BlockBasedTable::SetupForCompaction() { case Options::NONE: break; case Options::NORMAL: - rep_->file->Hint(RandomAccessFile::NORMAL); + rep_->file->file()->Hint(RandomAccessFile::NORMAL); break; case Options::SEQUENTIAL: - rep_->file->Hint(RandomAccessFile::SEQUENTIAL); + rep_->file->file()->Hint(RandomAccessFile::SEQUENTIAL); break; case Options::WILLNEED: - rep_->file->Hint(RandomAccessFile::WILLNEED); + rep_->file->file()->Hint(RandomAccessFile::WILLNEED); break; default: assert(false); diff --git a/util/file_reader_writer.h b/util/file_reader_writer.h index f33965dc6..4134a0ea2 100644 --- a/util/file_reader_writer.h +++ b/util/file_reader_writer.h @@ -46,7 +46,7 @@ class SequentialFileReader { SequentialFile* file() { return file_.get(); } }; -class RandomAccessFileReader : public RandomAccessFile { +class RandomAccessFileReader { private: std::unique_ptr file_; Env* env_;