@ -49,6 +49,8 @@ TEST_P(DBWriteTest, WriteThreadHangOnWriteStall) {
std : : atomic < int > thread_num ( 0 ) ;
std : : atomic < int > thread_num ( 0 ) ;
port : : Mutex mutex ;
port : : Mutex mutex ;
port : : CondVar cv ( & mutex ) ;
port : : CondVar cv ( & mutex ) ;
// Guarded by mutex
int writers = 0 ;
Reopen ( options ) ;
Reopen ( options ) ;
@ -68,6 +70,7 @@ TEST_P(DBWriteTest, WriteThreadHangOnWriteStall) {
} ;
} ;
std : : function < void ( void * ) > unblock_main_thread_func = [ & ] ( void * ) {
std : : function < void ( void * ) > unblock_main_thread_func = [ & ] ( void * ) {
mutex . Lock ( ) ;
mutex . Lock ( ) ;
+ + writers ;
cv . SignalAll ( ) ;
cv . SignalAll ( ) ;
mutex . Unlock ( ) ;
mutex . Unlock ( ) ;
} ;
} ;
@ -106,18 +109,18 @@ TEST_P(DBWriteTest, WriteThreadHangOnWriteStall) {
mutex . Lock ( ) ;
mutex . Lock ( ) ;
// First leader
// First leader
threads . emplace_back ( write_slowdown_func ) ;
threads . emplace_back ( write_slowdown_func ) ;
cv . Wait ( ) ;
while ( writers ! = 1 ) {
cv . Wait ( ) ;
}
// Second leader. Will stall writes
// Second leader. Will stall writes
threads . emplace_back ( write_slowdown_func ) ;
threads . emplace_back ( write_slowdown_func ) ;
cv . Wait ( ) ;
threads . emplace_back ( write_no_slowdown_func ) ;
threads . emplace_back ( write_no_slowdown_func ) ;
cv . Wait ( ) ;
threads . emplace_back ( write_slowdown_func ) ;
threads . emplace_back ( write_slowdown_func ) ;
cv . Wait ( ) ;
threads . emplace_back ( write_no_slowdown_func ) ;
threads . emplace_back ( write_no_slowdown_func ) ;
cv . Wait ( ) ;
threads . emplace_back ( write_slowdown_func ) ;
threads . emplace_back ( write_slowdown_func ) ;
cv . Wait ( ) ;
while ( writers ! = 6 ) {
cv . Wait ( ) ;
}
mutex . Unlock ( ) ;
mutex . Unlock ( ) ;
TEST_SYNC_POINT ( " DBWriteTest::WriteThreadHangOnWriteStall:1 " ) ;
TEST_SYNC_POINT ( " DBWriteTest::WriteThreadHangOnWriteStall:1 " ) ;
@ -131,6 +134,8 @@ TEST_P(DBWriteTest, WriteThreadHangOnWriteStall) {
for ( auto & t : threads ) {
for ( auto & t : threads ) {
t . join ( ) ;
t . join ( ) ;
}
}
ROCKSDB_NAMESPACE : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
ROCKSDB_NAMESPACE : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
TEST_P ( DBWriteTest , IOErrorOnWALWritePropagateToWriteThreadFollower ) {
TEST_P ( DBWriteTest , IOErrorOnWALWritePropagateToWriteThreadFollower ) {