make rocksdb_recovery_mode a u8, document it

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-23 00:27:33 -04:00 committed by June
parent 331c0b37cd
commit 101cb34f9a
3 changed files with 32 additions and 5 deletions

View file

@ -361,6 +361,33 @@ url_preview_check_root_domain = false
# Defaults to false as this uses more CPU when compressing.
#rocksdb_bottommost_compression = false
# RocksDB WAL recovery mode
#
# If the database becomes corrupted, an attempt at some form of recovery or at least opening it can be made
# using this config option.
#
# In this event, provided that you have searched for any backups already, it's recommended to start by using PointInTime recovery mode. If this opens your database successfully,
# you will want to immediately run the `clear-cache` database admin command and restart Conduwuit again setting this back to 1 (TolerateCorruptedTailRecords)
# If no further issues arrise, your database should be okay now.
#
# As a very last ditch effort, if PointInTime does not fix or resolve anything, you can try SkipAnyCorruptedRecord but this
# has a good chance to do more damage than before
#
# TolerateCorruptedTailRecords is the default as generally tail records may be caused by unclean shutdowns, and any data here is likely
# federation data that can be re-retrieved by other servers again.
#
#
# The options are:
# 0 = AbsoluteConsistency
# 1 = TolerateCorruptedTailRecords (default)
# 2 = PointInTime (use me if trying to recover)
# 3 = SkipAnyCorruptedRecord (you now voided your Conduwuit warranty)
#
# See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes for more information
#
# Defaults to 1 (TolerateCorruptedTailRecords)
#rocksdb_recovery_mode = 1
### Request Timeouts, Connection Timeouts, and Connection Pooling
@ -412,7 +439,7 @@ url_preview_check_root_domain = false
# You most definitely want this to be high to account for extremely large room joins, slow homeservers, your own resources etc.
#
# Defaults to 300 seconds
#federation_timeout
#federation_timeout = 300
# Federation client/sender max idle connections per host
#

View file

@ -162,7 +162,7 @@ pub struct Config {
#[serde(default)]
pub rocksdb_bottommost_compression: bool,
#[serde(default = "default_rocksdb_recovery_mode")]
pub rocksdb_recovery_mode: u32,
pub rocksdb_recovery_mode: u8,
pub emergency_password: Option<String>,
@ -454,7 +454,7 @@ impl fmt::Display for Config {
&self.rocksdb_bottommost_compression.to_string(),
),
#[cfg(feature = "rocksdb")]
("RocksDB Recovery mode", &self.rocksdb_recovery_mode.to_string()),
("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 {
@ -576,7 +576,7 @@ 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_recovery_mode() -> u8 { 1 }
fn default_rocksdb_log_level() -> String { "error".to_owned() }

View file

@ -116,7 +116,7 @@ fn db_options(
// Misc
db_opts.create_if_missing(true);
// https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes#ktoleratecorruptedtailrecords
// Default: https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes#ktoleratecorruptedtailrecords
//
// 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