diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs index 10bd0a26..6c9c3e05 100644 --- a/src/admin/debug/commands.rs +++ b/src/admin/debug/commands.rs @@ -1035,3 +1035,16 @@ pub(super) async fn create_jwt( .map(async |token| self.write_str(&token).await)? .await } + +#[admin_command] +pub(super) async fn resync_database(&self) -> Result { + if !self.services.db.is_secondary() { + return Err!("Not a secondary instance."); + } + + self.services + .db + .db + .update() + .map_err(|e| err!("Failed to update from primary: {e:?}")) +} diff --git a/src/admin/debug/mod.rs b/src/admin/debug/mod.rs index c634abb7..532a7e63 100644 --- a/src/admin/debug/mod.rs +++ b/src/admin/debug/mod.rs @@ -256,6 +256,9 @@ pub(super) enum DebugCommand { audience: Option, }, + /// - Synchronize database with primary (secondary only) + ResyncDatabase, + /// - Developer test stubs #[command(subcommand)] #[allow(non_snake_case)]