mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 04:51:08 +01:00
ircd::db: Add conf item to disable automatic compactions.
construct: Add -nocompact program option.
This commit is contained in:
parent
0f466e6b19
commit
b68b4d113a
3 changed files with 21 additions and 1 deletions
|
@ -24,6 +24,7 @@ bool single;
|
||||||
bool debugmode;
|
bool debugmode;
|
||||||
bool nolisten;
|
bool nolisten;
|
||||||
bool noautomod;
|
bool noautomod;
|
||||||
|
bool nocompact;
|
||||||
bool checkdb;
|
bool checkdb;
|
||||||
bool pitrecdb;
|
bool pitrecdb;
|
||||||
bool repairdb;
|
bool repairdb;
|
||||||
|
@ -54,6 +55,7 @@ lgetopt opts[]
|
||||||
{ "execute", &execute, lgetopt::STRINGS, "Execute command lines immediately after startup" },
|
{ "execute", &execute, lgetopt::STRINGS, "Execute command lines immediately after startup" },
|
||||||
{ "nolisten", &nolisten, lgetopt::BOOL, "Normal execution but without listening sockets" },
|
{ "nolisten", &nolisten, lgetopt::BOOL, "Normal execution but without listening sockets" },
|
||||||
{ "noautomod", &noautomod, lgetopt::BOOL, "Normal execution but without autoloading modules" },
|
{ "noautomod", &noautomod, lgetopt::BOOL, "Normal execution but without autoloading modules" },
|
||||||
|
{ "nocompact", &nocompact, lgetopt::BOOL, "Disable automatic database compaction" },
|
||||||
{ "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" },
|
{ "repairdb", &repairdb, lgetopt::BOOL, "Perform full DB repair after deep block/file corruption" },
|
||||||
|
@ -513,6 +515,9 @@ applyargs()
|
||||||
else
|
else
|
||||||
ircd::db::open_repair.set("false");
|
ircd::db::open_repair.set("false");
|
||||||
|
|
||||||
|
if(nocompact)
|
||||||
|
ircd::db::auto_compact.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
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace ircd::db
|
||||||
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;
|
extern conf::item<bool> open_repair;
|
||||||
|
extern conf::item<bool> auto_compact;
|
||||||
|
|
||||||
// General information
|
// General information
|
||||||
const std::string &name(const database &);
|
const std::string &name(const database &);
|
||||||
|
|
16
ircd/db.cc
16
ircd/db.cc
|
@ -442,6 +442,17 @@ ircd::db::open_repair
|
||||||
{ "persist", false },
|
{ "persist", false },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Conf item toggles whether automatic compaction is enabled or disabled for
|
||||||
|
/// all databases upon opening. This is useful for developers, debugging and
|
||||||
|
/// valgrind etc to prevent these background jobs from spawning when unwanted.
|
||||||
|
decltype(ircd::db::auto_compact)
|
||||||
|
ircd::db::auto_compact
|
||||||
|
{
|
||||||
|
{ "name", "ircd.db.compact.auto" },
|
||||||
|
{ "default", true },
|
||||||
|
{ "persist", false },
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::db::sync(database &d)
|
ircd::db::sync(database &d)
|
||||||
{
|
{
|
||||||
|
@ -2014,6 +2025,10 @@ ircd::db::database::column::column(database &d,
|
||||||
this->options.min_write_buffer_number_to_merge = 4;
|
this->options.min_write_buffer_number_to_merge = 4;
|
||||||
this->options.max_write_buffer_number_to_maintain = 0;
|
this->options.max_write_buffer_number_to_maintain = 0;
|
||||||
|
|
||||||
|
// Conf item can be set to disable automatic compactions. For developers
|
||||||
|
// and debugging; good for valgrind.
|
||||||
|
this->options.disable_auto_compactions = !bool(db::auto_compact);
|
||||||
|
|
||||||
// Set the compaction style; we don't override this in the descriptor yet.
|
// Set the compaction style; we don't override this in the descriptor yet.
|
||||||
//this->options.compaction_style = rocksdb::kCompactionStyleNone;
|
//this->options.compaction_style = rocksdb::kCompactionStyleNone;
|
||||||
this->options.compaction_style = rocksdb::kCompactionStyleLevel;
|
this->options.compaction_style = rocksdb::kCompactionStyleLevel;
|
||||||
|
@ -2033,7 +2048,6 @@ ircd::db::database::column::column(database &d,
|
||||||
|
|
||||||
this->options.num_levels = 7;
|
this->options.num_levels = 7;
|
||||||
this->options.level0_file_num_compaction_trigger = 2;
|
this->options.level0_file_num_compaction_trigger = 2;
|
||||||
this->options.disable_auto_compactions = false;
|
|
||||||
this->options.level_compaction_dynamic_level_bytes = false;
|
this->options.level_compaction_dynamic_level_bytes = false;
|
||||||
this->options.ttl = 0;
|
this->options.ttl = 0;
|
||||||
#ifdef IRCD_DB_HAS_PERIODIC_COMPACTIONS
|
#ifdef IRCD_DB_HAS_PERIODIC_COMPACTIONS
|
||||||
|
|
Loading…
Reference in a new issue