From e7ad14926a70fcc6317b346f273dfc0110d69f25 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 13 Apr 2015 11:39:45 -0700 Subject: [PATCH] Fix flakiness in FIFOCompaction test (github issue #573) Summary: The problem is that sometimes two memtables will be compacted together into a single file. In that case, our assertion ASSERT_EQ(NumTableFilesAtLevel(0), 5); fails because same amount of data is in 4 files instead of 5. We should wait for flush so that we prevent two memtables merging into a single file. Test Plan: `for i in `seq 20`; do mrtest FIFOCompactionTest; done` -- fails at least once before. fails zero times after. Reviewers: rven Reviewed By: rven Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D36939 --- db/db_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/db_test.cc b/db/db_test.cc index dd9477b55..ca68d1af0 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -9613,6 +9613,7 @@ TEST_F(DBTest, FIFOCompactionTest) { ASSERT_OK(Put(ToString(i * 100 + j), RandomString(&rnd, 1024))); } // flush should happen here + ASSERT_OK(dbfull()->TEST_WaitForFlushMemTable()); } if (iter == 0) { ASSERT_OK(dbfull()->TEST_WaitForCompact());