From 809cb4a0524b505476c9bd3f5d691560fed5d0ff Mon Sep 17 00:00:00 2001 From: qupeng Date: Fri, 13 Nov 2020 10:00:08 +0800 Subject: [PATCH] allow no_io for VersionSet::GetTableProperties (#211) * allow no_io for VersionSet::GetTableProperties Signed-off-by: qupeng Signed-off-by: tabokie --- db/compaction/compaction.cc | 3 ++- db/version_set.cc | 4 ++-- db/version_set.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/db/compaction/compaction.cc b/db/compaction/compaction.cc index 8d2bf4ef44f..181df406d2c 100644 --- a/db/compaction/compaction.cc +++ b/db/compaction/compaction.cc @@ -553,7 +553,8 @@ std::unique_ptr Compaction::CreateCompactionFilter( for (auto l = inputs_.begin(); l != inputs_.end(); ++l) { for (auto f = l->files.begin(); f != l->files.end(); ++f) { std::shared_ptr tp; - Status s = input_version_->GetTableProperties(&tp, *f); + Status s = + input_version_->GetTableProperties(&tp, *f, nullptr, false /*no_io*/); assert(s.ok()); context.file_numbers.push_back((*f)->fd.GetNumber()); context.table_properties.push_back(tp); diff --git a/db/version_set.cc b/db/version_set.cc index 6f0e2d55fb1..037a46c5980 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1239,12 +1239,12 @@ void LevelIterator::InitFileIterator(size_t new_file_index) { Status Version::GetTableProperties(std::shared_ptr* tp, const FileMetaData* file_meta, - const std::string* fname) const { + const std::string* fname, bool no_io) const { auto table_cache = cfd_->table_cache(); auto ioptions = cfd_->ioptions(); Status s = table_cache->GetTableProperties( file_options_, cfd_->internal_comparator(), file_meta->fd, tp, - mutable_cf_options_.prefix_extractor, true /* no io */); + mutable_cf_options_.prefix_extractor, no_io); if (s.ok()) { return s; } diff --git a/db/version_set.h b/db/version_set.h index e085cf66eb4..39811af3946 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -772,7 +772,8 @@ class Version { // file-name conversion. Status GetTableProperties(std::shared_ptr* tp, const FileMetaData* file_meta, - const std::string* fname = nullptr) const; + const std::string* fname = nullptr, + bool no_io = true) const; // REQUIRES: lock is held // On success, *props will be populated with all SSTables' table properties.