Skip to content

Commit

Permalink
make rocksdb_recovery_mode a u8, document it
Browse files Browse the repository at this point in the history
Signed-off-by: strawberry <[email protected]>
  • Loading branch information
girlbossceo committed Mar 23, 2024
1 parent d94319e commit eaca628
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions conduwuit-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,21 @@ 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.
#
# The options are:
# 0 = AbsoluteConsistency
# 1 = TolerateCorruptedTailRecords (default)
# 2 = PointInTime
# 3 = SkipAnyCorruptedRecord
#
# See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes#ktoleratecorruptedtailrecords for more information
#
# Defaults to 1 (TolerateCorruptedTailRecords)
#rocksdb_recovery_mode = 1



### Request Timeouts, Connection Timeouts, and Connection Pooling
Expand Down
6 changes: 3 additions & 3 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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() }

Expand Down
2 changes: 1 addition & 1 deletion src/database/abstraction/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eaca628

Please sign in to comment.