@ -623,8 +623,6 @@ Status DBImpl::UnorderedWriteMemtable(const WriteOptions& write_options,
0 /*log_number*/ , this , true /*concurrent_memtable_writes*/ ,
0 /*log_number*/ , this , true /*concurrent_memtable_writes*/ ,
seq_per_batch_ , sub_batch_cnt , true /*batch_per_txn*/ ,
seq_per_batch_ , sub_batch_cnt , true /*batch_per_txn*/ ,
write_options . memtable_insert_hint_per_batch ) ;
write_options . memtable_insert_hint_per_batch ) ;
WriteStatusCheck ( w . status ) ;
if ( write_options . disableWAL ) {
if ( write_options . disableWAL ) {
has_unpersisted_data_ . store ( true , std : : memory_order_relaxed ) ;
has_unpersisted_data_ . store ( true , std : : memory_order_relaxed ) ;
}
}
@ -639,6 +637,7 @@ Status DBImpl::UnorderedWriteMemtable(const WriteOptions& write_options,
std : : lock_guard < std : : mutex > lck ( switch_mutex_ ) ;
std : : lock_guard < std : : mutex > lck ( switch_mutex_ ) ;
switch_cv_ . notify_all ( ) ;
switch_cv_ . notify_all ( ) ;
}
}
WriteStatusCheck ( w . status ) ;
if ( ! w . FinalStatus ( ) . ok ( ) ) {
if ( ! w . FinalStatus ( ) . ok ( ) ) {
return w . FinalStatus ( ) ;
return w . FinalStatus ( ) ;
@ -689,7 +688,7 @@ Status DBImpl::WriteImplWALOnly(
InstrumentedMutexLock l ( & mutex_ ) ;
InstrumentedMutexLock l ( & mutex_ ) ;
bool need_log_sync = false ;
bool need_log_sync = false ;
status = PreprocessWrite ( write_options , & need_log_sync , & write_context ) ;
status = PreprocessWrite ( write_options , & need_log_sync , & write_context ) ;
WriteStatusCheck ( status ) ;
WriteStatusCheckOnLocked ( status ) ;
}
}
if ( ! status . ok ( ) ) {
if ( ! status . ok ( ) ) {
WriteThread : : WriteGroup write_group ;
WriteThread : : WriteGroup write_group ;
@ -830,6 +829,17 @@ Status DBImpl::WriteImplWALOnly(
return status ;
return status ;
}
}
void DBImpl : : WriteStatusCheckOnLocked ( const Status & status ) {
// Is setting bg_error_ enough here? This will at least stop
// compaction and fail any further writes.
// Caller must hold mutex_.
mutex_ . AssertHeld ( ) ;
if ( immutable_db_options_ . paranoid_checks & & ! status . ok ( ) & &
! status . IsBusy ( ) & & ! status . IsIncomplete ( ) ) {
error_handler_ . SetBGError ( status , BackgroundErrorReason : : kWriteCallback ) ;
}
}
void DBImpl : : WriteStatusCheck ( const Status & status ) {
void DBImpl : : WriteStatusCheck ( const Status & status ) {
// Is setting bg_error_ enough here? This will at least stop
// Is setting bg_error_ enough here? This will at least stop
// compaction and fail any further writes.
// compaction and fail any further writes.