From 410ca2efd2b1181827ea1148b88e82dc62bf85c6 Mon Sep 17 00:00:00 2001 From: zczhu <> Date: Fri, 24 Jun 2022 14:02:33 -0700 Subject: [PATCH] Fix the flaky cursor persist test (#10250) Summary: The 'PersistRoundRobinCompactCursor' unit test in `db_compaction_test` may occasionally fail due to the inconsistent LSM state. The issue is fixed by adding `Flush()` and `WaitForFlushMemTable()` to produce a more predictable and stable LSM state. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10250 Test Plan: 'PersistRoundRobinCompactCursor' unit test in `db_compaction_test` Reviewed By: jay-zhuang, riversand963 Differential Revision: D37426091 Pulled By: littlepig2013 fbshipit-source-id: 56fbaab0384c380c1f279a16dc8732b139c9f611 --- db/db_compaction_test.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index 125439b00..541405d45 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -5225,7 +5225,8 @@ INSTANTIATE_TEST_CASE_P( TEST_F(DBCompactionTest, PersistRoundRobinCompactCursor) { Options options = CurrentOptions(); options.write_buffer_size = 16 * 1024; - options.max_bytes_for_level_base = 64 * 1024; + options.max_bytes_for_level_base = 128 * 1024; + options.target_file_size_base = 64 * 1024; options.level0_file_num_compaction_trigger = 4; options.compaction_pri = CompactionPri::kRoundRobin; options.max_bytes_for_level_multiplier = 4; @@ -5241,6 +5242,7 @@ TEST_F(DBCompactionTest, PersistRoundRobinCompactCursor) { for (int j = 0; j < 16; j++) { ASSERT_OK(Put(rnd.RandomString(24), rnd.RandomString(1000))); } + ASSERT_OK(Flush()); } ASSERT_OK(dbfull()->TEST_WaitForCompact());