mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 12:18:54 +02:00
ircd::db::database: Hide dangerous best_efforts_recovery behind all-caps options.
This commit is contained in:
parent
06583f7bfb
commit
6e33d52bda
1 changed files with 12 additions and 12 deletions
|
@ -981,29 +981,29 @@ try
|
||||||
// When corrupted after crash, the DB is rolled back before the first
|
// When corrupted after crash, the DB is rolled back before the first
|
||||||
// corruption and erases everything after it, giving a consistent
|
// corruption and erases everything after it, giving a consistent
|
||||||
// state up at that point, though losing some recent data.
|
// state up at that point, though losing some recent data.
|
||||||
if(string_view(open_recover) == "point")
|
if(iequals(string_view(open_recover), "point"))
|
||||||
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kPointInTimeRecovery;
|
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kPointInTimeRecovery;
|
||||||
|
|
||||||
// When corrupted after crash and PointInTimeRecovery does not work,
|
|
||||||
// this will drop more data, but consistently. RocksDB sez the WAL is not
|
|
||||||
// used at all in this mode.
|
|
||||||
#if ROCKSDB_MAJOR > 6 \
|
|
||||||
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR >= 10)
|
|
||||||
if(string_view(open_recover) == "recover")
|
|
||||||
opts->best_efforts_recovery = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skipping corrupted records will create gaps in the DB timeline where the
|
// Skipping corrupted records will create gaps in the DB timeline where the
|
||||||
// application (like a matrix timeline) cannot tolerate the unexpected gap.
|
// application (like a matrix timeline) cannot tolerate the unexpected gap.
|
||||||
if(string_view(open_recover) == "skip" || string_view(open_recover) == "recover")
|
if(iequals(string_view(open_recover), "skip"))
|
||||||
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kSkipAnyCorruptedRecords;
|
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kSkipAnyCorruptedRecords;
|
||||||
|
|
||||||
// Tolerating corrupted records is very last-ditch for getting the database to
|
// Tolerating corrupted records is very last-ditch for getting the database to
|
||||||
// open in a catastrophe. We have no use for this option but should use it for
|
// open in a catastrophe. We have no use for this option but should use it for
|
||||||
//TODO: emergency salvage-mode.
|
//TODO: emergency salvage-mode.
|
||||||
if(string_view(open_recover) == "tolerate")
|
if(iequals(string_view(open_recover), "tolerate"))
|
||||||
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords;
|
opts->wal_recovery_mode = rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords;
|
||||||
|
|
||||||
|
// When the mode is all caps best efforts recovery is enabled. This is
|
||||||
|
// highly experimental and not well understood. Possibly in combination
|
||||||
|
// with an ill-selected above mode, the entire database may be destroyed.
|
||||||
|
#if ROCKSDB_MAJOR > 6 \
|
||||||
|
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR >= 10)
|
||||||
|
if(all_of<std::isupper>(string_view(open_recover)))
|
||||||
|
opts->best_efforts_recovery = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Setup env
|
// Setup env
|
||||||
opts->env = env.get();
|
opts->env = env.get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue