mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-05 20:42:54 +00:00
Compact RocksDB database after garbage collection.
Without this step, the page versions won't actually be removed, they're just marked for deletion on the next RocksDB "merge" or "compact" operation. Author: Konstantin Knizhnik
This commit is contained in:
@@ -623,6 +623,7 @@ impl ObjectTimeline {
|
||||
result.elapsed = now.elapsed();
|
||||
info!("Garbage collection completed in {:?}: {} relations inspected, {} version histories truncated, {} versions deleted, {} relations dropped",
|
||||
result.elapsed, &result.n_relations, &result.truncated, &result.deleted, &result.dropped);
|
||||
self.obj_store.compact();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -68,4 +68,7 @@ pub trait ObjectStore: Send + Sync {
|
||||
|
||||
/// Unlink object (used by GC). This mehod may actually delete object or just mark it for deletion.
|
||||
fn unlink(&self, key: &ObjectKey, lsn: Lsn) -> Result<()>;
|
||||
|
||||
// Compact storage and remove versions marged for deletion
|
||||
fn compact(&self);
|
||||
}
|
||||
|
||||
@@ -207,6 +207,10 @@ impl ObjectStore for RocksObjectStore {
|
||||
lsn,
|
||||
}))
|
||||
}
|
||||
|
||||
fn compact(&self) {
|
||||
self.db.compact_range::<&[u8], &[u8]>(None, None);
|
||||
}
|
||||
}
|
||||
|
||||
impl RocksObjectStore {
|
||||
|
||||
Reference in New Issue
Block a user