From ee910500843518ddbd66e2ed7235aee9bdb1f806 Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 6 May 2026 11:39:26 -0400 Subject: [PATCH] prevent writer drop on cursor reset --- constellation/src/bin/main.rs | 7 ++----- constellation/src/storage/rocks_store.rs | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/constellation/src/bin/main.rs b/constellation/src/bin/main.rs index 65ca956..d79f463 100644 --- a/constellation/src/bin/main.rs +++ b/constellation/src/bin/main.rs @@ -135,11 +135,8 @@ fn main() -> Result<()> { println!("rocks ready."); std::thread::scope(|s| { if args.reset_db_start { - let rocks = rocks.clone(); - s.spawn(move || { - let res = rocks.reset_start(); - eprintln!("reset start finished: {res:?}"); - }); + let res = rocks.reset_start(); + eprintln!("reset start finished: {res:?}"); } s.spawn(|| { let r = run( diff --git a/constellation/src/storage/rocks_store.rs b/constellation/src/storage/rocks_store.rs index 993931a..bb8ca2e 100644 --- a/constellation/src/storage/rocks_store.rs +++ b/constellation/src/storage/rocks_store.rs @@ -718,6 +718,8 @@ impl RocksStorage { impl Drop for RocksStorage { fn drop(&mut self) { if self.is_writer { + // TODO: cloning a writer is possible and currently breaks things + // (constellation code currently doesn't/shouldn't clone the writer) println!("rocksdb writer: cleaning up for shutdown..."); if let Err(e) = self.db.flush_wal(true) { eprintln!("rocks: flushing wal failed: {e:?}"); -- 2.51.2