Fix a corner-case panic in get_entries_in_data_block() (#27195)
#### Problem get_entries_in_data_block() panics when there's inconsistency between slot_meta and data_shred. However, as we don't lock on reads, reading across multiple column families is not atomic (especially for older slots) and thus does not guarantee consistency as the background cleanup service could purge the slot in the middle. Such panic was reported in #26980 when the validator serves a high load of RPC calls. #### Summary of Changes This PR makes get_entries_in_data_block() panic only when the inconsistency between slot-meta and data-shred happens on a slot older than lowest_cleanup_slot.
This commit is contained in:
parent
fda395af83
commit
6d12bb6ec3
|
@ -2872,6 +2872,7 @@ impl Blockstore {
|
|||
.and_then(|serialized_shred| {
|
||||
if serialized_shred.is_none() {
|
||||
if let Some(slot_meta) = slot_meta {
|
||||
if slot > self.lowest_cleanup_slot() {
|
||||
panic!(
|
||||
"Shred with
|
||||
slot: {},
|
||||
|
@ -2886,7 +2887,8 @@ impl Blockstore {
|
|||
start_index,
|
||||
end_index
|
||||
);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return Err(BlockstoreError::InvalidShredData(Box::new(
|
||||
bincode::ErrorKind::Custom(format!(
|
||||
"Missing shred for slot {}, index {}",
|
||||
|
@ -2894,7 +2896,6 @@ impl Blockstore {
|
|||
)),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
Shred::new_from_serialized_shred(serialized_shred.unwrap()).map_err(|err| {
|
||||
BlockstoreError::InvalidShredData(Box::new(bincode::ErrorKind::Custom(
|
||||
|
|
Loading…
Reference in New Issue