Skip to content
  • Yanqin Jin's avatar
    Fail point-in-time WAL recovery upon IOError reading WAL (#6963) · 717749f4
    Yanqin Jin authored
    Summary:
    If `options.wal_recovery_mode == WALRecoveryMode::kPointInTimeRecovery`, RocksDB stops replaying WAL once hitting an error and discards the rest of the WAL. This can lead to data loss if the error occurs at an offset smaller than the last sync'ed offset.
    Ideally, RocksDB point-in-time recovery should permit recovery if the error occurs after last synced offset while fail recovery if error occurs before the last synced offset. However, RocksDB does not track the synced offset of WALs. Consequently, RocksDB does not know whether an error occurs before or after the last synced offset. An error can be one of the following.
    - WAL record checksum mismatch. This can result from both corruption of synced data and dropping of unsynced data during shutdown. We cannot be sure which one. In order not to defeat the original motivation to permit the latter case, we keep the original behavior of point-in-time WAL recovery.
    - IOError. This means the WAL can be bad, an indicator of whole file becoming unavailable, not to mention synced part of the WAL. Therefore, we choose to modify the behavior of point-in-time recovery and fail the database recovery.
    
    Test plan (devserver):
    make check
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/6963
    
    Reviewed By: ajkr
    
    Differential Revision: D22011083
    
    Pulled By: riversand963
    
    fbshipit-source-id: f9cbf29a37dc5cc40d3fa62f89eed1ad67ca1536
    717749f4