diff --git a/zebra-scan/src/storage/db.rs b/zebra-scan/src/storage/db.rs index de5f83cbe5e..41f40f0c3b1 100644 --- a/zebra-scan/src/storage/db.rs +++ b/zebra-scan/src/storage/db.rs @@ -96,6 +96,8 @@ impl Storage { /// If a thread exited with a panic, resume that panic. /// /// This method should be called regularly, so that panics are detected as soon as possible. + // + // TODO: when we implement format changes, call this method regularly pub fn check_for_panics(&mut self) { self.db.check_for_panics() } diff --git a/zebra-state/src/service/finalized_state/zebra_db.rs b/zebra-state/src/service/finalized_state/zebra_db.rs index 155d19686aa..6229de1bca0 100644 --- a/zebra-state/src/service/finalized_state/zebra_db.rs +++ b/zebra-state/src/service/finalized_state/zebra_db.rs @@ -229,13 +229,16 @@ impl ZebraDb { /// /// See [`DiskDb::shutdown`] for details. pub fn shutdown(&mut self, force: bool) { + // Are we shutting down the underlying database instance? + let is_shutdown = force || self.db.shared_database_owners() <= 1; + // # Concurrency // // The format upgrade task should be cancelled before the database is flushed or shut down. // This helps avoid some kinds of deadlocks. // // See also the correctness note in `DiskDb::shutdown()`. - if force || self.db.shared_database_owners() <= 1 { + if !self.debug_skip_format_upgrades && is_shutdown { if let Some(format_change_handle) = self.format_change_handle.as_mut() { format_change_handle.force_cancel(); }