From d44ef2ed4dbd36afa992191bbefd93106d693312 Mon Sep 17 00:00:00 2001 From: Levi Tamasi Date: Wed, 23 Jun 2021 13:27:50 -0700 Subject: [PATCH] Remove obsolete method VersionSet::VerifyCompactionFileConsistency (#8449) Summary: `VersionSet::VerifyCompactionFileConsistency` was superseded by the LSM tree consistency checks introduced in https://github.com/facebook/rocksdb/pull/6901, which are more comprehensive, more efficient, and are performed unconditionally even in release builds. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8449 Test Plan: `make check` Reviewed By: ajkr Differential Revision: D29337441 Pulled By: ltamasi fbshipit-source-id: a05324f88e3400e27e6a00406c878a6276e0c9cc --- db/compaction/compaction_job.cc | 15 +------------ db/version_set.cc | 37 --------------------------------- db/version_set.h | 6 ------ 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/db/compaction/compaction_job.cc b/db/compaction/compaction_job.cc index a8e0bd596..6e30d9a65 100644 --- a/db/compaction/compaction_job.cc +++ b/db/compaction/compaction_job.cc @@ -1784,19 +1784,6 @@ Status CompactionJob::InstallCompactionResults( auto* compaction = compact_->compaction; assert(compaction); - // paranoia: verify that the files that we started with - // still exist in the current version and in the same original level. - // This ensures that a concurrent compaction did not erroneously - // pick the same files to compact_. - if (!versions_->VerifyCompactionFileConsistency(compaction)) { - Compaction::InputLevelSummaryBuffer inputs_summary; - - ROCKS_LOG_ERROR(db_options_.info_log, "[%s] [JOB %d] Compaction %s aborted", - compaction->column_family_data()->GetName().c_str(), - job_id_, compaction->InputLevelSummary(&inputs_summary)); - return Status::Corruption("Compaction input files inconsistent"); - } - { Compaction::InputLevelSummaryBuffer inputs_summary; ROCKS_LOG_INFO(db_options_.info_log, @@ -2219,7 +2206,7 @@ Status CompactionServiceCompactionJob::Run() { status = io_s; } if (status.ok()) { - // TODO: Add verify_table() and VerifyCompactionFileConsistency() + // TODO: Add verify_table() } // Finish up all book-keeping to unify the subcompaction results diff --git a/db/version_set.cc b/db/version_set.cc index 1360a0834..1b20fd05f 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -5495,43 +5495,6 @@ InternalIterator* VersionSet::MakeInputIterator( return result; } -// verify that the files listed in this compaction are present -// in the current version -bool VersionSet::VerifyCompactionFileConsistency(Compaction* c) { -#ifndef NDEBUG - Version* version = c->column_family_data()->current(); - const VersionStorageInfo* vstorage = version->storage_info(); - if (c->input_version() != version) { - ROCKS_LOG_INFO( - db_options_->info_log, - "[%s] compaction output being applied to a different base version from" - " input version", - c->column_family_data()->GetName().c_str()); - } - - for (size_t input = 0; input < c->num_input_levels(); ++input) { - int level = c->level(input); - for (size_t i = 0; i < c->num_input_files(input); ++i) { - uint64_t number = c->input(input, i)->fd.GetNumber(); - bool found = false; - for (size_t j = 0; j < vstorage->files_[level].size(); j++) { - FileMetaData* f = vstorage->files_[level][j]; - if (f->fd.GetNumber() == number) { - found = true; - break; - } - } - if (!found) { - return false; // input files non existent in current version - } - } - } -#else - (void)c; -#endif - return true; // everything good -} - Status VersionSet::GetMetadataForFile(uint64_t number, int* filelevel, FileMetaData** meta, ColumnFamilyData** cfd) { diff --git a/db/version_set.h b/db/version_set.h index bbe872c99..c9f0e160f 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -1222,12 +1222,6 @@ class VersionSet { // Return the size of the current manifest file uint64_t manifest_file_size() const { return manifest_file_size_; } - // verify that the files that we started with for a compaction - // still exist in the current version and in the same original level. - // This ensures that a concurrent compaction did not erroneously - // pick the same files to compact. - bool VerifyCompactionFileConsistency(Compaction* c); - Status GetMetadataForFile(uint64_t number, int* filelevel, FileMetaData** metadata, ColumnFamilyData** cfd);