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
main
Jay Zhuang 4 years ago committed by Facebook GitHub Bot
parent 4926b33742
commit a3066ee75c
  1. 1
      utilities/checkpoint/checkpoint_impl.cc
  2. 2
      utilities/checkpoint/checkpoint_test.cc

@ -247,6 +247,7 @@ Status CheckpointImpl::CreateCustomCheckpoint(
// GetLiveFiles atomically. But that needs changes to GetLiveFiles' signature // GetLiveFiles atomically. But that needs changes to GetLiveFiles' signature
// which is a public API. // which is a public API.
s = db_->GetLiveFiles(live_files, &manifest_file_size, flush_memtable); 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:SavedLiveFiles1");
TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:SavedLiveFiles2"); TEST_SYNC_POINT("CheckpointImpl::CreateCheckpoint:SavedLiveFiles2");

@ -543,7 +543,7 @@ TEST_F(CheckpointTest, CurrentFileModifiedWhileCheckpointing) {
{// Get past the flush in the checkpoint thread before adding any keys to {// Get past the flush in the checkpoint thread before adding any keys to
// the db so the checkpoint thread won't hit the WriteManifest // the db so the checkpoint thread won't hit the WriteManifest
// syncpoints. // syncpoints.
{"DBImpl::GetLiveFiles:1", {"CheckpointImpl::CreateCheckpoint:FlushDone",
"CheckpointTest::CurrentFileModifiedWhileCheckpointing:PrePut"}, "CheckpointTest::CurrentFileModifiedWhileCheckpointing:PrePut"},
// Roll the manifest during checkpointing right after live files are // Roll the manifest during checkpointing right after live files are
// snapshotted. // snapshotted.

Loading…
Cancel
Save