Atomically update blob info with pruned blobs
This commit is contained in:
parent
5d2480c762
commit
6dff69bde9
@ -827,6 +827,10 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
get_key_for_col(DBColumn::BeaconBlobOrphan.into(), block_root.as_bytes());
|
get_key_for_col(DBColumn::BeaconBlobOrphan.into(), block_root.as_bytes());
|
||||||
key_value_batch.push(KeyValueStoreOp::PutKeyValue(db_key, [].into()));
|
key_value_batch.push(KeyValueStoreOp::PutKeyValue(db_key, [].into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoreOp::PutRawKVStoreOp(kv_store_op) => {
|
||||||
|
key_value_batch.push(kv_store_op);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(key_value_batch)
|
Ok(key_value_batch)
|
||||||
@ -869,6 +873,8 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
StoreOp::DeleteExecutionPayload(_) => (),
|
StoreOp::DeleteExecutionPayload(_) => (),
|
||||||
|
|
||||||
StoreOp::PutOrphanedBlobsKey(_) => (),
|
StoreOp::PutOrphanedBlobsKey(_) => (),
|
||||||
|
|
||||||
|
StoreOp::PutRawKVStoreOp(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1865,8 +1871,16 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let blobs_sidecars_pruned = ops.len();
|
let blobs_sidecars_pruned = ops.len();
|
||||||
|
|
||||||
|
let update_blob_info = self.compare_and_set_blob_info(
|
||||||
|
Some(blob_info),
|
||||||
|
Some(BlobInfo {
|
||||||
|
oldest_blob_slot: end_slot + 1,
|
||||||
|
}),
|
||||||
|
)?;
|
||||||
|
ops.push(StoreOp::PutRawKVStoreOp(update_blob_info));
|
||||||
|
|
||||||
self.do_atomically(ops)?;
|
self.do_atomically(ops)?;
|
||||||
info!(
|
info!(
|
||||||
self.log,
|
self.log,
|
||||||
@ -1874,13 +1888,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
|||||||
"blobs_sidecars_pruned" => blobs_sidecars_pruned,
|
"blobs_sidecars_pruned" => blobs_sidecars_pruned,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.compare_and_set_blob_info_with_write(
|
|
||||||
Some(blob_info),
|
|
||||||
Some(BlobInfo {
|
|
||||||
oldest_blob_slot: end_slot + 1,
|
|
||||||
}),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,6 +166,7 @@ pub enum StoreOp<'a, E: EthSpec> {
|
|||||||
DeleteBlobs(Hash256),
|
DeleteBlobs(Hash256),
|
||||||
DeleteState(Hash256, Option<Slot>),
|
DeleteState(Hash256, Option<Slot>),
|
||||||
DeleteExecutionPayload(Hash256),
|
DeleteExecutionPayload(Hash256),
|
||||||
|
PutRawKVStoreOp(KeyValueStoreOp),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A unique column identifier.
|
/// A unique column identifier.
|
||||||
|
Loading…
Reference in New Issue
Block a user