Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit ded307a

Browse files
author
Tyera
authored
storage-bigtable: delete entry rows if they exist when deleting confirmed block (#34261)
Delete entry rows if they exist
1 parent 2bde5c3 commit ded307a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

storage-bigtable/src/lib.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,13 @@ impl LedgerStorage {
11331133
vec![]
11341134
};
11351135

1136+
let entries_exist = self
1137+
.connection
1138+
.client()
1139+
.row_key_exists("entries", slot_to_entries_key(slot))
1140+
.await
1141+
.is_ok_and(|x| x);
1142+
11361143
if !dry_run {
11371144
if !address_slot_rows.is_empty() {
11381145
self.connection
@@ -1146,17 +1153,24 @@ impl LedgerStorage {
11461153
.await?;
11471154
}
11481155

1156+
if entries_exist {
1157+
self.connection
1158+
.delete_rows_with_retry("entries", &[slot_to_entries_key(slot)])
1159+
.await?;
1160+
}
1161+
11491162
self.connection
11501163
.delete_rows_with_retry("blocks", &[slot_to_blocks_key(slot)])
11511164
.await?;
11521165
}
11531166

11541167
info!(
1155-
"{}deleted ledger data for slot {}: {} transaction rows, {} address slot rows",
1168+
"{}deleted ledger data for slot {}: {} transaction rows, {} address slot rows, {} entry row",
11561169
if dry_run { "[dry run] " } else { "" },
11571170
slot,
11581171
tx_deletion_rows.len(),
1159-
address_slot_rows.len()
1172+
address_slot_rows.len(),
1173+
if entries_exist { "with" } else {"WITHOUT"}
11601174
);
11611175

11621176
Ok(())

0 commit comments

Comments
 (0)