From 42c631b339f0119bb6e4e05d58b23cc3e5ee9bcf Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Tue, 21 Jun 2022 23:34:39 -0700 Subject: [PATCH] Update API comment about Options::best_efforts_recovery (#10180) Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/10180 Reviewed By: pdillinger Differential Revision: D37182037 Pulled By: riversand963 fbshipit-source-id: a8dc865b86e2249beb7a543c317e94a14781e910 --- include/rocksdb/options.h | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 542955e90..ef1623478 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -1274,13 +1274,30 @@ struct DBOptions { // Default: nullptr std::shared_ptr file_checksum_gen_factory = nullptr; - // By default, RocksDB recovery fails if any table file referenced in - // MANIFEST are missing after scanning the MANIFEST. - // Best-efforts recovery is another recovery mode that - // tries to restore the database to the most recent point in time without - // missing file. - // Currently not compatible with atomic flush. Furthermore, WAL files will + // By default, RocksDB recovery fails if any table/blob file referenced in + // MANIFEST are missing after scanning the MANIFEST pointed to by the + // CURRENT file. + // Best-efforts recovery is another recovery mode that tolerates missing or + // corrupted table or blob files. + // Best-efforts recovery does not need a valid CURRENT file, and tries to + // recover the database using one of the available MANIFEST files in the db + // directory. + // Best-efforts recovery recovers database to a state in which the database + // includes only table and blob files whose actual sizes match the + // information in the chosen MANIFEST without holes in the history. + // Best-efforts recovery tries the available MANIFEST files from high file + // numbers (newer) to low file numbers (older), and stops after finding the + // first MANIFEST file from which the db can be recovered to a state without + // invalid (missing/file-mismatch) table and blob files. + // It is possible that the database can be restored to an empty state with no + // table or blob files. + // Regardless of this option, the IDENTITY file is updated if needed during + // recovery to match the DB ID in the MANIFEST (if previously using + // write_dbid_to_manifest) or to be in some valid state (non-empty DB ID). + // Currently, not compatible with atomic flush. Furthermore, WAL files will // not be used for recovery if best_efforts_recovery is true. + // Also requires either 1) LOCK file exists or 2) underlying env's LockFile() + // call returns ok even for non-existing LOCK file. // Default: false bool best_efforts_recovery = false;