fix: Compact the whole database for each WriteBatch injected

This commit is contained in:
Clément Renault 2019-03-04 15:00:53 +01:00
parent a45cc4b618
commit 383a49b44f
No known key found for this signature in database
GPG Key ID: 0151CDAB43460DAE

View File

@ -266,6 +266,7 @@ impl DatabaseIndex {
fn commit_update(&self, update: Update) -> Result<Arc<DatabaseView<Arc<DB>>>, Box<Error>> { fn commit_update(&self, update: Update) -> Result<Arc<DatabaseView<Arc<DB>>>, Box<Error>> {
let batch = update.build()?; let batch = update.build()?;
self.db.write(batch)?; self.db.write(batch)?;
self.db.compact_range(None, None);
let snapshot = Snapshot::new(self.db.clone()); let snapshot = Snapshot::new(self.db.clone());
let view = Arc::new(DatabaseView::new(snapshot)?); let view = Arc::new(DatabaseView::new(snapshot)?);