diff --git a/changelog.md b/changelog.md index eefb155..ee3e6cf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-04-05 - 2.5.9 - fix(rustdb-storage) +run collection compaction during file storage initialization after crashes + +- Triggers compaction for all loaded collections before starting the periodic background compaction task. +- Helps clean up dead weight left from before a crash during startup. + ## 2026-04-05 - 2.5.8 - fix(rustdb-storage) detect stale hint files using data file size metadata and add restart persistence regression tests diff --git a/rust/crates/rustdb-storage/src/file.rs b/rust/crates/rustdb-storage/src/file.rs index 88ff590..a52cbc2 100644 --- a/rust/crates/rustdb-storage/src/file.rs +++ b/rust/crates/rustdb-storage/src/file.rs @@ -504,6 +504,13 @@ impl StorageAdapter for FileStorageAdapter { "FileStorageAdapter initialization complete" ); + // Run compaction on all collections that need it (dead weight from before crash) + for entry in self.collections.iter() { + let state = entry.value(); + let _guard = state.write_lock.lock().unwrap(); + state.try_compact(); + } + // Start periodic compaction task (runs every 24 hours) { let collections = self.collections.clone(); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index f8cca68..172158c 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartdb', - version: '2.5.8', + version: '2.5.9', description: 'A MongoDB-compatible embedded database server with wire protocol support, backed by a high-performance Rust engine.' }