@@ -423,14 +423,17 @@ void ErrorHandler::SetBGError(const Status& bg_status,
423
423
reason == BackgroundErrorReason::kMemTable ||
424
424
reason == BackgroundErrorReason::kFlush );
425
425
}
426
- if (db_options_.manual_wal_flush && wal_related && bg_io_err.IsIOError ()) {
427
- // With manual_wal_flush, a WAL write failure can drop buffered WAL writes.
428
- // Memtables and WAL then become inconsistent. A successful memtable flush
429
- // on one CF can cause CFs to be inconsistent upon restart. Before we fix
430
- // the bug in auto recovery from WAL write failures that can flush one CF
431
- // at a time, we set the error severity to fatal to disallow auto recovery.
432
- // TODO: remove parameter `wal_related` once we can automatically recover
433
- // from WAL write failures.
426
+
427
+ // When `atomic_flush = false` with multiple column families, when
428
+ // encountering WAL related IO error, individual CF flushing during auto
429
+ // recovery can create data inconsistencies where some column families advance
430
+ // past the corruption point while others remain behind, preventing successful
431
+ // database restart. Therefore we disable auto recovery by setting a higher
432
+ // severity `Status::Severity::kFatalError`.
433
+ bool has_multiple_cfs =
434
+ db_->versions_ ->GetColumnFamilySet ()->NumberOfColumnFamilies () > 1 ;
435
+ if (!db_options_.atomic_flush && has_multiple_cfs && wal_related &&
436
+ bg_io_err.IsIOError ()) {
434
437
bool auto_recovery = false ;
435
438
Status bg_err (new_bg_io_err, Status::Severity::kFatalError );
436
439
CheckAndSetRecoveryAndBGError (bg_err);
0 commit comments