From 41e554da2bc059c9d1c1425f5de9e12dcb3434e8 Mon Sep 17 00:00:00 2001 From: Akanksha Mahajan Date: Tue, 23 Mar 2021 17:36:28 -0700 Subject: [PATCH] Fix Race condition in db_sst_test (#8092) Summary: Fix race condition in DBSSTTest.DBWithMaxSpaceAllowedWithBlobFiles where background flush thread updates delete_blob_file but in test thread Flush() already completes after getting bg_error and delete_blob_file remains false. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8092 Test Plan: Ran ASAN job few times on CircleCI Reviewed By: riversand963 Differential Revision: D27275815 Pulled By: akankshamahajan15 fbshipit-source-id: 2939ad1671403881573bbe07c71aa474c5019130 --- db/db_sst_test.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/db_sst_test.cc b/db/db_sst_test.cc index 21d9ccf2c..038f87227 100644 --- a/db/db_sst_test.cc +++ b/db/db_sst_test.cc @@ -1088,6 +1088,12 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedWithBlobFiles) { ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( "BuildTable::AfterDeleteFile", [&](void* /*arg*/) { delete_blob_file = true; }); + ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->LoadDependency({ + { + "BuildTable::AfterDeleteFile", + "DBSSTTest::DBWithMaxSpaceAllowedWithBlobFiles:1", + }, + }); ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); @@ -1095,6 +1101,8 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedWithBlobFiles) { // This flush will fail ASSERT_NOK(Flush()); ASSERT_TRUE(max_allowed_space_reached); + + TEST_SYNC_POINT("DBSSTTest::DBWithMaxSpaceAllowedWithBlobFiles:1"); ASSERT_TRUE(delete_blob_file); ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->DisableProcessing(); }