提交 7330ec0f 编写于 作者: A anand76 提交者: Facebook Github Bot

Fix a test failure in error_handler_test (#6367)

Summary:
Fix an intermittent failure in
DBErrorHandlingTest.CompactionManifestWriteError due to a race between
background error recovery and the main test thread calling
TEST_WaitForCompact().
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6367

Test Plan: Run the test using gtest_parallel

Differential Revision: D19713802

Pulled By: anand1976

fbshipit-source-id: 29e35dc26e0984fe8334c083e059f4fa1f335d68
上级 f195d8d5
...@@ -298,7 +298,7 @@ TEST_F(DBErrorHandlingTest, CompactionManifestWriteError) { ...@@ -298,7 +298,7 @@ TEST_F(DBErrorHandlingTest, CompactionManifestWriteError) {
"DBImpl::BackgroundCallCompaction:FoundObsoleteFiles"}, "DBImpl::BackgroundCallCompaction:FoundObsoleteFiles"},
// Wait for DB instance to clear bg_error before calling // Wait for DB instance to clear bg_error before calling
// TEST_WaitForCompact // TEST_WaitForCompact
{"SstFileManagerImpl::ClearError", {"SstFileManagerImpl::ErrorCleared",
"CompactionManifestWriteError:2"}}); "CompactionManifestWriteError:2"}});
// trigger manifest write failure in compaction thread // trigger manifest write failure in compaction thread
rocksdb::SyncPoint::GetInstance()->SetCallBack( rocksdb::SyncPoint::GetInstance()->SetCallBack(
......
...@@ -308,8 +308,8 @@ void SstFileManagerImpl::ClearError() { ...@@ -308,8 +308,8 @@ void SstFileManagerImpl::ClearError() {
// since the ErrorHandler::recovery_in_prog_ flag would be true // since the ErrorHandler::recovery_in_prog_ flag would be true
cur_instance_ = error_handler; cur_instance_ = error_handler;
mu_.Unlock(); mu_.Unlock();
TEST_SYNC_POINT("SstFileManagerImpl::ClearError");
s = error_handler->RecoverFromBGError(); s = error_handler->RecoverFromBGError();
TEST_SYNC_POINT("SstFileManagerImpl::ErrorCleared");
mu_.Lock(); mu_.Lock();
// The DB instance might have been deleted while we were // The DB instance might have been deleted while we were
// waiting for the mutex, so check cur_instance_ to make sure its // waiting for the mutex, so check cur_instance_ to make sure its
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册