0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 06:51:08 +01: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 noautomod;
bool checkdb; bool checkdb;
bool pitrecdb; bool pitrecdb;
bool repairdb;
bool nojs; bool nojs;
bool nodirect; bool nodirect;
bool noaio; bool noaio;
@ -51,6 +52,7 @@ lgetopt opts[]
{ "noautomod", &noautomod, lgetopt::BOOL, "Normal execution but without autoloading modules" }, { "noautomod", &noautomod, lgetopt::BOOL, "Normal execution but without autoloading modules" },
{ "checkdb", &checkdb, lgetopt::BOOL, "Perform complete checks of databases when opening" }, { "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" }, { "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)." }, { "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." }, { "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. " }, { "noaio", &noaio, lgetopt::BOOL, "Disable the AIO interface in favor of traditional syscalls. " },
@ -468,6 +470,11 @@ applyargs()
else else
ircd::db::open_recover.set("absolute"); ircd::db::open_recover.set("absolute");
if(repairdb)
ircd::db::open_repair.set("true");
else
ircd::db::open_repair.set("false");
if(nodirect) if(nodirect)
ircd::fs::fd::opts::direct_io_enable.set("false"); ircd::fs::fd::opts::direct_io_enable.set("false");
else else

View file

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

View file

@ -383,6 +383,25 @@ ircd::db::open_recover
{ "persist", false }, { "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 void
ircd::db::sync(database &d) ircd::db::sync(database &d)
{ {
@ -1098,7 +1117,7 @@ try
} }
,fsck ,fsck
{ {
false db::open_repair
} }
,read_only ,read_only
{ {