From 6980fb6da291fe5f4740f2ff38cafc46b506849d Mon Sep 17 00:00:00 2001 From: Philippe McLean Date: Thu, 5 Mar 2026 12:48:21 -0800 Subject: [PATCH] add per-DB flush logging with elapsed time, flush cache_db Log each database flush separately with elapsed time so it is easy to see how long each one takes. Also flush cache_db alongside txstore_db and history_db: cache_db receives WAL-disabled writes when --address-search is enabled, so it needs the same explicit flush at the end of initial sync to ensure durability. --- src/new_index/schema.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/new_index/schema.rs b/src/new_index/schema.rs index 7d187e541..797dcd57d 100644 --- a/src/new_index/schema.rs +++ b/src/new_index/schema.rs @@ -374,9 +374,23 @@ impl Indexer { self.start_auto_compactions(&self.store.cache_db); if let DBFlush::Disable = self.flush { - debug!("flushing to disk"); + let t = std::time::Instant::now(); + debug!("flushing txstore_db to disk"); self.store.txstore_db.flush(); + debug!("flushing txstore_db complete in {:.1?}", t.elapsed()); + + let t = std::time::Instant::now(); + debug!("flushing history_db to disk"); self.store.history_db.flush(); + debug!("flushing history_db complete in {:.1?}", t.elapsed()); + + // cache_db receives WAL-disabled writes when --address-search is enabled, + // so it needs the same explicit flush to ensure durability. + let t = std::time::Instant::now(); + debug!("flushing cache_db to disk"); + self.store.cache_db.flush(); + debug!("flushing cache_db complete in {:.1?}", t.elapsed()); + self.flush = DBFlush::Enable; }