Skip to content

Commit 593e273

Browse files
committed
Use drop_cf to clear fullsync headers table
1 parent a23be6e commit 593e273

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

crates/storage/store_db/rocksdb.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,19 +1520,7 @@ impl StoreEngine for Store {
15201520
let db = self.db.clone();
15211521

15221522
tokio::task::spawn_blocking(move || {
1523-
let cf = db
1524-
.cf_handle(CF_FULLSYNC_HEADERS)
1525-
.ok_or_else(|| StoreError::Custom("Column family not found".to_string()))?;
1526-
1527-
let mut iter = db.iterator_cf(&cf, rocksdb::IteratorMode::Start);
1528-
let mut batch = WriteBatchWithTransaction::default();
1529-
1530-
while let Some(Ok((key, _))) = iter.next() {
1531-
batch.delete_cf(&cf, key);
1532-
}
1533-
1534-
db.write(batch)
1535-
.map_err(|e| StoreError::Custom(format!("RocksDB batch write error: {}", e)))
1523+
db.drop_cf(CF_FULLSYNC_HEADERS).map_err(StoreError::from)
15361524
})
15371525
.await
15381526
.map_err(|e| StoreError::Custom(format!("Task panicked: {}", e)))?

0 commit comments

Comments
 (0)