fix: Remove rocksdb secondary mode

This commit is contained in:
Terry 2026-02-18 23:04:00 +00:00 committed by Ellis Git
parent 6a0b103722
commit 7ecac93ddc
9 changed files with 6 additions and 43 deletions

View file

@ -1056,10 +1056,6 @@
# #
#rocksdb_repair = false #rocksdb_repair = false
# This item is undocumented. Please contribute documentation for it.
#
#rocksdb_secondary = false
# Enables idle CPU priority for compaction thread. This is not enabled by # Enables idle CPU priority for compaction thread. This is not enabled by
# default to prevent compaction from falling too far behind on busy # default to prevent compaction from falling too far behind on busy
# systems. # systems.
@ -1193,8 +1189,8 @@
# Allow outgoing typing updates to federation. # Allow outgoing typing updates to federation.
# #
# Note that sending typing indicators to remote servers in large rooms # Note that sending typing indicators to remote servers in large rooms
# with lots of other homeservers may cause additional strain on the CPU and # with lots of other homeservers may cause additional strain on the CPU
# network. # and network.
# #
#allow_outgoing_typing = true #allow_outgoing_typing = true

View file

@ -1244,9 +1244,6 @@ pub struct Config {
#[serde(default)] #[serde(default)]
pub rocksdb_repair: bool, pub rocksdb_repair: bool,
#[serde(default)]
pub rocksdb_secondary: bool,
/// Enables idle CPU priority for compaction thread. This is not enabled by /// Enables idle CPU priority for compaction thread. This is not enabled by
/// default to prevent compaction from falling too far behind on busy /// default to prevent compaction from falling too far behind on busy
/// systems. /// systems.

View file

@ -33,7 +33,6 @@ pub struct Engine {
pub(crate) db: Db, pub(crate) db: Db,
pub(crate) pool: Arc<Pool>, pub(crate) pool: Arc<Pool>,
pub(crate) ctx: Arc<Context>, pub(crate) ctx: Arc<Context>,
pub(super) secondary: bool,
pub(crate) checksums: bool, pub(crate) checksums: bool,
corks: AtomicU32, corks: AtomicU32,
} }
@ -128,14 +127,6 @@ impl Engine {
sequence sequence
} }
#[inline]
#[must_use]
pub fn is_read_only(&self) -> bool { self.secondary }
#[inline]
#[must_use]
pub fn is_secondary(&self) -> bool { self.secondary }
} }
impl Drop for Engine { impl Drop for Engine {

View file

@ -12,9 +12,8 @@ pub fn backup(&self) -> Result {
let mut engine = self.backup_engine()?; let mut engine = self.backup_engine()?;
let config = &self.ctx.server.config; let config = &self.ctx.server.config;
if config.database_backups_to_keep > 0 { if config.database_backups_to_keep > 0 {
let flush = !self.is_read_only();
engine engine
.create_new_backup_flush(&self.db, flush) .create_new_backup_flush(&self.db, true)
.map_err(map_err)?; .map_err(map_err)?;
let engine_info = engine.get_backup_info(); let engine_info = engine.get_backup_info();

View file

@ -35,11 +35,7 @@ pub(crate) async fn open(ctx: Arc<Context>, desc: &[Descriptor]) -> Result<Arc<S
} }
debug!("Opening database..."); debug!("Opening database...");
let db = if config.rocksdb_secondary { let db = Db::open_cf_descriptors(&db_opts, path, cfds)
Db::open_cf_descriptors_as_secondary(&db_opts, path, path, cfds)
} else {
Db::open_cf_descriptors(&db_opts, path, cfds)
}
.or_else(or_else)?; .or_else(or_else)?;
info!( info!(
@ -53,7 +49,6 @@ pub(crate) async fn open(ctx: Arc<Context>, desc: &[Descriptor]) -> Result<Arc<S
db, db,
pool: ctx.pool.clone(), pool: ctx.pool.clone(),
ctx: ctx.clone(), ctx: ctx.clone(),
secondary: config.rocksdb_secondary,
checksums: config.rocksdb_checksums, checksums: config.rocksdb_checksums,
corks: AtomicU32::new(0), corks: AtomicU32::new(0),
})) }))

View file

@ -74,14 +74,6 @@ impl Database {
#[inline] #[inline]
pub fn keys(&self) -> impl Iterator<Item = &MapsKey> + Send + '_ { self.maps.keys() } pub fn keys(&self) -> impl Iterator<Item = &MapsKey> + Send + '_ { self.maps.keys() }
#[inline]
#[must_use]
pub fn is_read_only(&self) -> bool { self.db.is_read_only() }
#[inline]
#[must_use]
pub fn is_secondary(&self) -> bool { self.db.is_secondary() }
} }
impl Index<&str> for Database { impl Index<&str> for Database {

View file

@ -37,10 +37,6 @@ impl crate::Service for Service {
} }
async fn worker(self: Arc<Self>) -> Result { async fn worker(self: Arc<Self>) -> Result {
if self.services.globals.is_read_only() {
return Ok(());
}
if self.services.config.ldap.enable { if self.services.config.ldap.enable {
warn!("emergency password feature not available with LDAP enabled."); warn!("emergency password feature not available with LDAP enabled.");
return Ok(()); return Ok(());

View file

@ -156,7 +156,4 @@ impl Service {
pub fn server_is_ours(&self, server_name: &ServerName) -> bool { pub fn server_is_ours(&self, server_name: &ServerName) -> bool {
server_name == self.server_name() server_name == self.server_name()
} }
#[inline]
pub fn is_read_only(&self) -> bool { self.db.db.is_read_only() }
} }

View file

@ -139,7 +139,7 @@ impl Services {
// reset dormant online/away statuses to offline, and set the server user as // reset dormant online/away statuses to offline, and set the server user as
// online // online
if self.server.config.allow_local_presence && !self.db.is_read_only() { if self.server.config.allow_local_presence {
self.presence.unset_all_presence().await; self.presence.unset_all_presence().await;
_ = self _ = self
.presence .presence
@ -156,7 +156,7 @@ impl Services {
info!("Shutting down services..."); info!("Shutting down services...");
// set the server user as offline // set the server user as offline
if self.server.config.allow_local_presence && !self.db.is_read_only() { if self.server.config.allow_local_presence {
_ = self _ = self
.presence .presence
.ping_presence(&self.globals.server_user, &ruma::presence::PresenceState::Offline) .ping_presence(&self.globals.server_user, &ruma::presence::PresenceState::Offline)