From c1b3cde18abf2749ca6772cb8747510778c410b3 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Fri, 13 Mar 2015 13:11:08 -0700 Subject: [PATCH] Improve the robustness of ThreadStatusSingleCompaction Summary: Improve the robustness of ThreadStatusSingleCompaction by ensuring the number of files flushed in the test. Test Plan: export ROCKSDB_TESTS=ThreadStatus ./db_test Reviewers: sdong, igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D35019 --- db/db_test.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index 84e1d3fa4..aa419c454 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -10176,10 +10176,13 @@ TEST(DBTest, ThreadStatusSingleCompaction) { DestroyAndReopen(options); Random rnd(301); - for (int key = kEntriesPerBuffer * kNumL0Files; key >= 0; --key) { - ASSERT_OK(Put(ToString(key), RandomString(&rnd, kTestValueSize))); + for (int file = 0; file < kNumL0Files; ++file) { + for (int key = 0; key < kEntriesPerBuffer; ++key) { + ASSERT_OK(Put(ToString(key + file * kEntriesPerBuffer), + RandomString(&rnd, kTestValueSize))); + } + Flush(); } - Flush(); ASSERT_GE(NumTableFilesAtLevel(0), options.level0_file_num_compaction_trigger);