Skip to content

Commit

Permalink
allow no_io for VersionSet::GetTableProperties (tikv#211)
Browse files Browse the repository at this point in the history
* allow no_io for VersionSet::GetTableProperties

Signed-off-by: qupeng <[email protected]>
Signed-off-by: tabokie <[email protected]>
  • Loading branch information
hicqu authored and tabokie committed May 11, 2022
1 parent 21ec181 commit 809cb4a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion db/compaction/compaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ std::unique_ptr<CompactionFilter> 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<const TableProperties> 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);
Expand Down
4 changes: 2 additions & 2 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1239,12 +1239,12 @@ void LevelIterator::InitFileIterator(size_t new_file_index) {

Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* 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;
}
Expand Down
3 changes: 2 additions & 1 deletion db/version_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,8 @@ class Version {
// file-name conversion.
Status GetTableProperties(std::shared_ptr<const TableProperties>* 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.
Expand Down

0 comments on commit 809cb4a

Please sign in to comment.