From dff9219df6765e0357e5f1aaab61fcee088a47c6 Mon Sep 17 00:00:00 2001 From: Jay Zhuang Date: Sat, 9 Jan 2021 13:22:01 -0800 Subject: [PATCH] Fix checkpoint_test hang (#7849) Summary: `CheckpointTest.CurrentFileModifiedWhileCheckpointing` could hang because now create checkpoint triggers flush twice. The test should wait both flush done. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7849 Test Plan: `gtest-parallel ./checkpoint_test --gtest_filter=CheckpointTest.CurrentFileModifiedWhileCheckpointing -r 100` Reviewed By: ajkr Differential Revision: D25860713 Pulled By: jay-zhuang fbshipit-source-id: e1c2f23037dedc33e205519f4289a25e77816b41 --- utilities/checkpoint/checkpoint_impl.cc | 1 + utilities/checkpoint/checkpoint_test.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/checkpoint/checkpoint_impl.cc b/utilities/checkpoint/checkpoint_impl.cc index b533c1d3d..bea5d69e2 100644 --- a/utilities/checkpoint/checkpoint_impl.cc +++ b/utilities/checkpoint/checkpoint_impl.cc @@ -247,6 +247,7 @@ Status CheckpointImpl::CreateCustomCheckpoint( // GetLiveFiles atomically. But that needs changes to GetLiveFiles' signature // which is a public API. s = db_->GetLiveFiles(live_files, &manifest_file_size, flush_memtable); + TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:FlushDone"); TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:SavedLiveFiles1"); TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"); diff --git a/utilities/checkpoint/checkpoint_test.cc b/utilities/checkpoint/checkpoint_test.cc index 784fb5d46..d63f34483 100644 --- a/utilities/checkpoint/checkpoint_test.cc +++ b/utilities/checkpoint/checkpoint_test.cc @@ -549,7 +549,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) { {// Get past the flush in the checkpoint thread before adding any keys to // the db so the checkpoint thread won't hit the WriteManifest // syncpoints. - {"DBImpl::GetLiveFiles:1", + {"CheckpointImpl::CreateCheckpoint:FlushDone", "CheckpointTest::CurrentFileModifiedWhileCheckpointing:PrePut"}, // Roll the manifest during checkpointing right after live files are // snapshotted.