Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 905c4d2

Browse files
authoredJan 20, 2023
Flush objects memtable after pruning (MystenLabs#7550)
1 parent f543517 commit 905c4d2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎crates/sui-core/src/authority/authority_store_pruner.rs

+5
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ impl AuthorityStorePruner {
147147
info!("Starting pruning of objects table");
148148
let num_pruned = Self::prune_objects(num_versions_to_retain, perpetual_db.clone());
149149
info!("Finished pruning with total object versions pruned = {}", num_pruned);
150+
if let Ok(()) = perpetual_db.objects.flush() {
151+
info!("Completed flushing objects table");
152+
} else {
153+
error!("Failed to flush objects table");
154+
}
150155
let start = Instant::now();
151156
let min_key = ObjectKey(ObjectID::ZERO, SequenceNumber::MIN);
152157
let max_key = ObjectKey(ObjectID::MAX, SequenceNumber::MAX);

‎crates/typed-store/src/rocks/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ impl RocksDB {
340340
delegate_call!(self.flush())
341341
}
342342

343+
pub fn flush_cf(&self, cf: &impl AsColumnFamilyRef) -> Result<(), rocksdb::Error> {
344+
delegate_call!(self.flush_cf(cf))
345+
}
346+
343347
pub fn set_options_cf(
344348
&self,
345349
cf: &impl AsColumnFamilyRef,
@@ -539,6 +543,10 @@ impl<K, V> DBMap<K, V> {
539543
self.rocksdb.iterator_cf(&self.cf(), IteratorMode::Start)
540544
}
541545

546+
pub fn flush(&self) -> Result<(), rocksdb::Error> {
547+
self.rocksdb.flush_cf(&self.cf())
548+
}
549+
542550
pub fn set_options(&self, opts: &[(&str, &str)]) -> Result<(), rocksdb::Error> {
543551
self.rocksdb.set_options_cf(&self.cf(), opts)
544552
}

0 commit comments

Comments
 (0)
Please sign in to comment.