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
main
Levi Tamasi 3 years ago committed by Facebook GitHub Bot
parent 6adc39e1bf
commit d44ef2ed4d
  1. 15
      db/compaction/compaction_job.cc
  2. 37
      db/version_set.cc
  3. 6
      db/version_set.h

@ -1784,19 +1784,6 @@ Status CompactionJob::InstallCompactionResults(
auto* compaction = compact_->compaction; auto* compaction = compact_->compaction;
assert(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; Compaction::InputLevelSummaryBuffer inputs_summary;
ROCKS_LOG_INFO(db_options_.info_log, ROCKS_LOG_INFO(db_options_.info_log,
@ -2219,7 +2206,7 @@ Status CompactionServiceCompactionJob::Run() {
status = io_s; status = io_s;
} }
if (status.ok()) { if (status.ok()) {
// TODO: Add verify_table() and VerifyCompactionFileConsistency() // TODO: Add verify_table()
} }
// Finish up all book-keeping to unify the subcompaction results // Finish up all book-keeping to unify the subcompaction results

@ -5495,43 +5495,6 @@ InternalIterator* VersionSet::MakeInputIterator(
return result; 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, Status VersionSet::GetMetadataForFile(uint64_t number, int* filelevel,
FileMetaData** meta, FileMetaData** meta,
ColumnFamilyData** cfd) { ColumnFamilyData** cfd) {

@ -1222,12 +1222,6 @@ class VersionSet {
// Return the size of the current manifest file // Return the size of the current manifest file
uint64_t manifest_file_size() const { return manifest_file_size_; } 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, Status GetMetadataForFile(uint64_t number, int* filelevel,
FileMetaData** metadata, ColumnFamilyData** cfd); FileMetaData** metadata, ColumnFamilyData** cfd);

Loading…
Cancel
Save