Assertion failure for L0-L1 compactions.

Summary:
For level-0 compactions, we try to find if can include more L0 files
in the same compaction run. This causes the 'smallest' and 'largest'
key to get extended to a larger range. But the suceeding call to
ParentRangeInCompaction() was still using the earlier
values of 'smallest' and 'largest',

Because of this bug, a file in L1 can be part of two concurrent
compactions: one L0-L1 compaction and the other L1-L2 compaction.

This should not cause any data loss, but will cause an assertion
failure with debug builds.

Test Plan: make check

Differential Revision: https://reviews.facebook.net/D10677
main
Dhruba Borthakur 11 years ago
parent 988c20b9f7
commit a8d3aa2c26
  1. 5
      db/version_set.cc

@ -2082,6 +2082,11 @@ Compaction* VersionSet::PickCompaction() {
// which will include the picked file.
c->inputs_[0].clear();
current_->GetOverlappingInputs(0, &smallest, &largest, &c->inputs_[0]);
// If we include more L0 files in the same compaction run it can
// cause the 'smallest' and 'largest' key to get extended to a
// larger range. So, re-invoke GetRange to get the new key range
GetRange(c->inputs_[0], &smallest, &largest);
if (ParentRangeInCompaction(&smallest, &largest,
level, &c->parent_index_)) {
delete c;

Loading…
Cancel
Save