0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-23 04:18:22 +02:00

ircd::db: Add conf item to repair on open.

This commit is contained in:
Jason Volk 2020-01-11 19:14:32 -08:00
parent 86bf383b4d
commit b0a773c922
3 changed files with 28 additions and 1 deletions

View file

@ -24,6 +24,7 @@ bool nolisten;
bool noautomod;
bool checkdb;
bool pitrecdb;
bool repairdb;
bool nojs;
bool nodirect;
bool noaio;
@ -51,6 +52,7 @@ lgetopt opts[]
{ "noautomod", &noautomod, lgetopt::BOOL, "Normal execution but without autoloading modules" },
{ "checkdb", &checkdb, lgetopt::BOOL, "Perform complete checks of databases when opening" },
{ "pitrecdb", &pitrecdb, lgetopt::BOOL, "Allow Point-In-Time-Recover if DB reports corruption after crash" },
{ "repairdb", &repairdb, lgetopt::BOOL, "Perform full DB repair after deep block/file corruption." },
{ "nojs", &nojs, lgetopt::BOOL, "Disable SpiderMonkey JS subsystem from initializing. (noop when not available)." },
{ "nodirect", &nodirect, lgetopt::BOOL, "Disable direct IO (O_DIRECT) for unsupporting filesystems." },
{ "noaio", &noaio, lgetopt::BOOL, "Disable the AIO interface in favor of traditional syscalls. " },
@ -468,6 +470,11 @@ applyargs()
else
ircd::db::open_recover.set("absolute");
if(repairdb)
ircd::db::open_repair.set("true");
else
ircd::db::open_repair.set("false");
if(nodirect)
ircd::fs::fd::opts::direct_io_enable.set("false");
else

View file

@ -18,6 +18,7 @@ namespace ircd::db
// Broad conf items
extern conf::item<bool> open_check;
extern conf::item<std::string> open_recover;
extern conf::item<bool> open_repair;
// General information
const std::string &name(const database &);

View file

@ -383,6 +383,25 @@ ircd::db::open_recover
{ "persist", false },
};
/// Conf item determines if database repair should occur (before open). This
/// mechanism can be used when SST file corruption occurs which is too deep
/// for log-based recovery. The affected blocks may be discarded; this risks
/// destabilizing an application expecting the data in those blocks to exist.
///
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
///
/// Use with caution.
///
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
///
decltype(ircd::db::open_repair)
ircd::db::open_repair
{
{ "name", "ircd.db.open.repair" },
{ "default", false },
{ "persist", false },
};
void
ircd::db::sync(database &d)
{
@ -1098,7 +1117,7 @@ try
}
,fsck
{
false
db::open_repair
}
,read_only
{