Venkatesh Radhakrishnan 20b244fcca Fix CompactFiles by adding all necessary files
Summary:
The compact files API had a bug where some overlapping files
are not added. These are files which overlap with files which were
added to the compaction input files, but not to the original set of
input files. This happens only when there are more than two levels
involved in the compaction. An example will illustrate this better.

Level 2 has 1 input file 1.sst which spans [20,30].

Level 3 has added file  2.sst which spans [10,25]

Level 4 has file 3.sst which spans [35,40] and
        input file 4.sst which spans [46,50].

The existing code would not add 3.sst to the set of input_files because
it only becomes an overlapping file in level 4 and it wasn't one in
level 3.

When installing the results of the compaction, 3.sst would overlap with
output file from the compact files and result in the assertion in
version_set.cc:1130

 // Must not overlap
   assert(level <= 0 || level_files->empty() ||
            internal_comparator_->Compare(
                (*level_files)[level_files->size() - 1]->largest, f->smallest) <
                0);
This change now adds overlapping files from the current level to the set
of input files also so that we don't hit the assertion above.

Test Plan:
d=/tmp/j; rm -rf $d; seq 1000 | parallel --gnu --eta
'd=/tmp/j/d-{}; mkdir -p $d; TEST_TMPDIR=$d ./db_compaction_test
--gtest_filter=*CompactilesOnLevel* --gtest_also_run_disabled_tests >&
'$d'/log-{}'

Reviewers: igor, yhchiang, sdong

Reviewed By: yhchiang

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D43437
2015-08-03 15:53:22 -07:00
..
2015-07-17 18:59:11 +02:00
2015-07-17 12:02:52 -07:00
2015-07-20 17:20:40 -07:00
2015-07-20 17:20:40 -07:00
2015-04-23 12:10:36 -07:00
2015-03-17 14:08:00 -07:00
2015-01-26 11:48:07 -08:00
2015-07-07 12:10:10 -07:00
2015-07-07 12:10:10 -07:00
2015-03-30 16:05:35 -04:00
2015-03-17 14:08:00 -07:00
2015-02-06 08:44:30 -08:00
2015-07-21 21:33:20 -07:00
2015-07-20 17:20:40 -07:00
2014-11-10 17:39:38 -05:00
2015-07-29 16:54:23 -07:00
2015-07-29 16:54:23 -07:00
2015-07-29 16:54:23 -07:00
2015-05-29 14:36:35 -07:00