From c5b467306d34b87eded191330fdd5eea0d74de96 Mon Sep 17 00:00:00 2001 From: agiardullo Date: Thu, 19 Nov 2015 18:01:46 -0800 Subject: [PATCH] Fix race condition that causes valgrind failures Summary: DBTest.DynamicLevelCompressionPerLevel2 sometimes fails during valgrind runs. This causes our valgrind tests to fail. Not sure what the best fix is for this test, but hopefully this simple change is sufficient. Test Plan: run test Reviewers: sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D51111 --- db/db_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/db_test.cc b/db/db_test.cc index 965389289..57b82719a 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -7466,8 +7466,14 @@ TEST_F(DBTest, DynamicLevelCompressionPerLevel2) { for (int i = 0; i < 100; i++) { ASSERT_OK(Put(Key(keys[i]), RandomString(&rnd, 200))); + + if (i % 25 == 0) { + dbfull()->TEST_WaitForFlushMemTable(); + } } + Flush(); + dbfull()->TEST_WaitForFlushMemTable(); dbfull()->TEST_WaitForCompact(); rocksdb::SyncPoint::GetInstance()->DisableProcessing(); rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks();