From 290e1d2ff71af5ec6a76950805a2fd83a11200c4 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Mon, 6 Feb 2023 10:28:32 +0100 Subject: [PATCH] fixup! Complete making blocks and blobs db atomic --- beacon_node/store/src/hot_cold_store.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index 17c5a81b8..f8d143dcc 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -907,15 +907,17 @@ impl, Cold: ItemStore> HotColdDB }; // Rollback on failure if let Err(e) = tx_res { + let mut blob_cache_ops = blob_cache_ops; for op in blob_cache_ops.iter_mut() { let reverse_op = match op { - StoreOp::PutBlobs(block_root, _) => StoreOp::DeleteBlobs(block_root), + StoreOp::PutBlobs(block_root, _) => StoreOp::DeleteBlobs(*block_root), StoreOp::DeleteBlobs(_) => match blobs_to_delete.pop() { Some(blobs) => StoreOp::PutBlobs(blobs.beacon_block_root, Arc::new(blobs)), None => return Err(HotColdDBError::Rollback.into()), }, _ => return Err(HotColdDBError::Rollback.into()), }; + *op = reverse_op; } blobs_db.do_atomically(self.convert_to_kv_batch(blob_cache_ops)?)?; return Err(e);