[RocksDB] Fix DBTest.UniversalCompactionTrigger to reflect the correct compaction trigger condition.

Summary: as title

Test Plan: make db_test; ./db_test

Reviewers: dhruba

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D12981
This commit is contained in:
Haobo Xu 2013-09-17 13:56:30 -07:00
parent 11c65021fb
commit 5b76338c01

View File

@ -1599,8 +1599,8 @@ TEST(DBTest, UniversalCompactionTrigger) {
Options options = CurrentOptions(); Options options = CurrentOptions();
options.compaction_style = kCompactionStyleUniversal; options.compaction_style = kCompactionStyleUniversal;
options.write_buffer_size = 100<<10; //100KB options.write_buffer_size = 100<<10; //100KB
// trigger compaction if there are > 3 files // trigger compaction if there are >= 4 files
options.level0_file_num_compaction_trigger = 3; options.level0_file_num_compaction_trigger = 4;
Reopen(&options); Reopen(&options);
Random rnd(301); Random rnd(301);
@ -1610,7 +1610,7 @@ TEST(DBTest, UniversalCompactionTrigger) {
// Generate a set of files at level 0, but don't trigger level-0 // Generate a set of files at level 0, but don't trigger level-0
// compaction. // compaction.
for (int num = 0; for (int num = 0;
num < options.level0_file_num_compaction_trigger; num < options.level0_file_num_compaction_trigger-1;
num++) { num++) {
// Write 120KB (12 values, each 10K) // Write 120KB (12 values, each 10K)
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
@ -1645,7 +1645,7 @@ TEST(DBTest, UniversalCompactionTrigger) {
// data amount). // data amount).
dbfull()->Flush(FlushOptions()); dbfull()->Flush(FlushOptions());
for (int num = 0; for (int num = 0;
num < options.level0_file_num_compaction_trigger-2; num < options.level0_file_num_compaction_trigger-3;
num++) { num++) {
// Write 120KB (12 values, each 10K) // Write 120KB (12 values, each 10K)
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
@ -1674,7 +1674,7 @@ TEST(DBTest, UniversalCompactionTrigger) {
// Now we have 2 files at level 0, with size 4 and 2.4. Continue // Now we have 2 files at level 0, with size 4 and 2.4. Continue
// generating new files at level 0. // generating new files at level 0.
for (int num = 0; for (int num = 0;
num < options.level0_file_num_compaction_trigger-2; num < options.level0_file_num_compaction_trigger-3;
num++) { num++) {
// Write 120KB (12 values, each 10K) // Write 120KB (12 values, each 10K)
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {