0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::db: Set max_open_files=-1 when required for secondary mode.

ircd:Ⓜ️:dbs: Condition option from being set in slave/secondary mode.

ircd::db: Skip snapshot creation in slave/secondary mode (required).

ircd::db: Slave implies read-only.
This commit is contained in:
Jason Volk 2020-07-27 21:57:35 -07:00
parent daa3cd6284
commit f2c182b403
3 changed files with 10 additions and 5 deletions

View file

@ -1208,7 +1208,7 @@ try
}
,read_only
{
ircd::read_only
slave || ircd::read_only
}
,env
{
@ -1281,7 +1281,9 @@ try
// limit maxfdto prevent too many small files degrading read perf; too low is
// bad for write perf.
opts->max_open_files = fs::support::rlimit_nofile();
opts->max_open_files = !slave?
fs::support::rlimit_nofile():
-1;
// TODO: Check if these values can be increased; RocksDB may keep
// thread_local state preventing values > 1.
@ -2410,7 +2412,10 @@ ircd::db::sequence(const rocksdb::Snapshot *const &rs)
ircd::db::database::snapshot::snapshot(database &d)
:s
{
d.d->GetSnapshot(),
!d.slave?
d.d->GetSnapshot():
nullptr,
[dp(weak_from(d))](const rocksdb::Snapshot *const s)
{
if(!s)

View file

@ -57,7 +57,7 @@ ircd::m::dbs::sst_write_buffer_size
{
static const string_view key{"writable_file_max_buffer_size"};
const size_t &value{sst_write_buffer_size};
if(events)
if(events && !events->slave)
db::setopt(*events, key, lex_cast(value));
}
};

View file

@ -106,7 +106,7 @@ noexcept
db::sequence(*m::dbs::events) : 0UL,
};
assert(retired == sequence::retired);
assert(retired == sequence::retired || ircd::read_only);
}
//