diff --git a/db/db_test.cc b/db/db_test.cc index dbe4a161b..7afe317db 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -2332,6 +2332,13 @@ TEST_F(DBTest, ReadonlyDBGetLiveManifestSize) { } TEST_F(DBTest, GetLiveBlobFiles) { + // Note: the following prevents an otherwise harmless data race between the + // test setup code (AddBlobFile) below and the periodic stat dumping thread. + Options options = CurrentOptions(); + options.stats_dump_period_sec = 0; + + Reopen(options); + VersionSet* const versions = dbfull()->TEST_GetVersionSet(); assert(versions); assert(versions->GetColumnFamilySet()); diff --git a/db/obsolete_files_test.cc b/db/obsolete_files_test.cc index 8159581a3..ee6b07639 100644 --- a/db/obsolete_files_test.cc +++ b/db/obsolete_files_test.cc @@ -94,6 +94,12 @@ class ObsoleteFilesTest : public DBTestBase { options.WAL_ttl_seconds = 300; // Used to test log files options.WAL_size_limit_MB = 1024; // Used to test log files options.wal_dir = wal_dir_; + + // Note: the following prevents an otherwise harmless data race between the + // test setup code (AddBlobFile) in ObsoleteFilesTest.BlobFiles and the + // periodic stat dumping thread. + options.stats_dump_period_sec = 0; + Destroy(options); Reopen(options); } @@ -192,6 +198,8 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) { } TEST_F(ObsoleteFilesTest, BlobFiles) { + ReopenDB(); + VersionSet* const versions = dbfull()->TEST_GetVersionSet(); assert(versions); assert(versions->GetColumnFamilySet());