fix(rustdb-storage): run collection compaction during file storage initialization after crashes
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user