add conf item for alternate rocksdb recovery modes.
This commit is contained in:
parent
a57f4db207
commit
331c0b37cd
2 changed files with 13 additions and 1 deletions
|
@ -161,6 +161,8 @@ pub struct Config {
|
|||
pub rocksdb_bottommost_compression_level: i32,
|
||||
#[serde(default)]
|
||||
pub rocksdb_bottommost_compression: bool,
|
||||
#[serde(default = "default_rocksdb_recovery_mode")]
|
||||
pub rocksdb_recovery_mode: u32,
|
||||
|
||||
pub emergency_password: Option<String>,
|
||||
|
||||
|
@ -451,6 +453,8 @@ impl fmt::Display for Config {
|
|||
"RocksDB Bottommost Level Compression",
|
||||
&self.rocksdb_bottommost_compression.to_string(),
|
||||
),
|
||||
#[cfg(feature = "rocksdb")]
|
||||
("RocksDB Recovery mode", &self.rocksdb_recovery_mode.to_string()),
|
||||
("Prevent Media Downloads From", {
|
||||
let mut lst = vec![];
|
||||
for domain in &self.prevent_media_downloads_from {
|
||||
|
@ -572,6 +576,8 @@ fn default_presence_idle_timeout_s() -> u64 { 5 * 60 }
|
|||
|
||||
fn default_presence_offline_timeout_s() -> u64 { 30 * 60 }
|
||||
|
||||
fn default_rocksdb_recovery_mode() -> u32 { 1 }
|
||||
|
||||
fn default_rocksdb_log_level() -> String { "error".to_owned() }
|
||||
|
||||
fn default_rocksdb_log_time_to_roll() -> usize { 0 }
|
||||
|
|
|
@ -121,7 +121,13 @@ fn db_options(
|
|||
// Unclean shutdowns of a Matrix homeserver are likely to be fine when
|
||||
// recovered in this manner as it's likely any lost information will be
|
||||
// restored via federation.
|
||||
db_opts.set_wal_recovery_mode(rust_rocksdb::DBRecoveryMode::TolerateCorruptedTailRecords);
|
||||
db_opts.set_wal_recovery_mode(match config.rocksdb_recovery_mode {
|
||||
0 => rust_rocksdb::DBRecoveryMode::AbsoluteConsistency,
|
||||
1 => rust_rocksdb::DBRecoveryMode::TolerateCorruptedTailRecords,
|
||||
2 => rust_rocksdb::DBRecoveryMode::PointInTime,
|
||||
3 => rust_rocksdb::DBRecoveryMode::SkipAnyCorruptedRecord,
|
||||
4_u8..=u8::MAX => unimplemented!(),
|
||||
});
|
||||
|
||||
db_opts.set_block_based_table_factory(&block_based_options);
|
||||
db_opts.set_env(env);
|
||||
|
|
Loading…
Add table
Reference in a new issue