From 167ba599ec3c7e1cb678453bff05cf028ab4757e Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Thu, 2 Nov 2017 13:20:28 -0700 Subject: [PATCH] Blob DB: Fix flaky BlobDBTest::GCExpiredKeyWhileOverwriting test Summary: The test intent to wait until key being overwritten until proceed with garbage collection. It failed to wait for `PutUntil` finally finish. Fixing it. Closes https://github.com/facebook/rocksdb/pull/3116 Differential Revision: D6222833 Pulled By: yiwu-arbug fbshipit-source-id: fa9b57a772b92a66cf250b44e7975c43f62f45c5 --- utilities/blob_db/blob_db_impl.cc | 4 ++-- utilities/blob_db/blob_db_test.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utilities/blob_db/blob_db_impl.cc b/utilities/blob_db/blob_db_impl.cc index 1653e5bb1..17b832e37 100644 --- a/utilities/blob_db/blob_db_impl.cc +++ b/utilities/blob_db/blob_db_impl.cc @@ -838,6 +838,7 @@ Status BlobDBImpl::PutWithTTL(const WriteOptions& options, Status BlobDBImpl::PutUntil(const WriteOptions& options, const Slice& key, const Slice& value, uint64_t expiration) { + TEST_SYNC_POINT("BlobDBImpl::PutUntil:Start"); MutexLock l(&write_mutex_); SequenceNumber sequence = GetLatestSequenceNumber() + 1; WriteBatch batch; @@ -845,13 +846,13 @@ Status BlobDBImpl::PutUntil(const WriteOptions& options, const Slice& key, if (s.ok()) { s = db_->Write(options, &batch); } + TEST_SYNC_POINT("BlobDBImpl::PutUntil:Finish"); return s; } Status BlobDBImpl::PutBlobValue(const WriteOptions& options, const Slice& key, const Slice& value, uint64_t expiration, SequenceNumber sequence, WriteBatch* batch) { - TEST_SYNC_POINT("BlobDBImpl::PutBlobValue:Start"); Status s; std::string index_entry; uint32_t column_family_id = @@ -903,7 +904,6 @@ Status BlobDBImpl::PutBlobValue(const WriteOptions& options, const Slice& key, } } - TEST_SYNC_POINT("BlobDBImpl::PutBlobValue:Finish"); return s; } diff --git a/utilities/blob_db/blob_db_test.cc b/utilities/blob_db/blob_db_test.cc index 0eb4d791b..9ffdb234f 100644 --- a/utilities/blob_db/blob_db_test.cc +++ b/utilities/blob_db/blob_db_test.cc @@ -642,8 +642,8 @@ TEST_F(BlobDBTest, GCRelocateKeyWhileOverwriting) { SyncPoint::GetInstance()->LoadDependency( {{"BlobDBImpl::GCFileAndUpdateLSM:AfterGetFromBaseDB", - "BlobDBImpl::PutBlobValue:Start"}, - {"BlobDBImpl::PutBlobValue:Finish", + "BlobDBImpl::PutUntil:Start"}, + {"BlobDBImpl::PutUntil:Finish", "BlobDBImpl::GCFileAndUpdateLSM:BeforeRelocate"}}); SyncPoint::GetInstance()->EnableProcessing(); @@ -680,8 +680,8 @@ TEST_F(BlobDBTest, GCExpiredKeyWhileOverwriting) { SyncPoint::GetInstance()->LoadDependency( {{"BlobDBImpl::GCFileAndUpdateLSM:AfterGetFromBaseDB", - "BlobDBImpl::PutBlobValue:Start"}, - {"BlobDBImpl::PutBlobValue:Finish", + "BlobDBImpl::PutUntil:Start"}, + {"BlobDBImpl::PutUntil:Finish", "BlobDBImpl::GCFileAndUpdateLSM:BeforeDelete"}}); SyncPoint::GetInstance()->EnableProcessing();