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
main
Yi Wu 7 years ago committed by Facebook Github Bot
parent 25ac1697b4
commit 167ba599ec
  1. 4
      utilities/blob_db/blob_db_impl.cc
  2. 8
      utilities/blob_db/blob_db_test.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;
}

@ -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();

Loading…
Cancel
Save