]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix the false positive alert of CF consistency check in WAL recovery (#8207)
authorZhichao Cao <zhichao@fb.com>
Thu, 22 Apr 2021 17:27:56 +0000 (10:27 -0700)
committerZhichao Cao <zhichao@fb.com>
Fri, 23 Apr 2021 23:42:20 +0000 (16:42 -0700)
commit8bd665331a9bb68db2eccafde6a75d0bfeff45e9
tree6b4dca1bba853e08764c138fc14dca4069cbc8c9
parent9da35858912bf4b5821cf355bda8f4e4923a1315
Fix the false positive alert of CF consistency check in WAL recovery (#8207)

Summary:
In current RocksDB, in recover the information form WAL, we do the consistency check for each column family when one WAL file is corrupted and PointInTimeRecovery is set. However, it will report a false positive alert on "SST file is ahead of WALs" when one of the CF current log number is greater than the corrupted WAL number (CF contains the data beyond the corrupted WAl) due to a new column family creation during flush. In this case, a new WAL is created (it is empty) during a flush. Also, due to some reason (e.g., storage issue or crash happens before SyncCloseLog is called), the old WAL is corrupted. The new CF has no data, therefore, it does not have the consistency issue.

Fix: when checking cfd->GetLogNumber() > corrupted_wal_number also check cfd->GetLiveSstFilesSize() > 0. So the CFs with no SST file data will skip the check here.

Note potential ignored inconsistency caused due to fix: empty CF can also be caused by write+delete. In this case, after flush, there is no SST files being generated. However, this CF still have the log in the WAL. When the WAL is corrupted, the DB might be inconsistent.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8207

Test Plan: added unit test, make crash_test

Reviewed By: riversand963

Differential Revision: D27898839

Pulled By: zhichao-cao

fbshipit-source-id: 931fc2d8b92dd00b4169bf84b94e712fd688a83e
HISTORY.md
db/db_impl/db_impl_compaction_flush.cc
db/db_impl/db_impl_open.cc
db/db_test2.cc
db/db_test_util.h