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

Fix the inconsistency check in get_entries_in_data_block() #27195

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Avoid panic on race condition between read and purge
  • Loading branch information
yhchiang-sol committed Aug 18, 2022
commit 68c8027a23ded3b92916960d236a029cbc14aaa4
43 changes: 22 additions & 21 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2872,28 +2872,29 @@ impl Blockstore {
.and_then(|serialized_shred| {
if serialized_shred.is_none() {
if let Some(slot_meta) = slot_meta {
panic!(
yhchiang-sol marked this conversation as resolved.
Show resolved Hide resolved
"Shred with
slot: {},
index: {},
consumed: {},
completed_indexes: {:?}
must exist if shred index was included in a range: {} {}",
slot,
i,
slot_meta.consumed,
slot_meta.completed_data_indexes,
start_index,
end_index
);
} else {
return Err(BlockstoreError::InvalidShredData(Box::new(
bincode::ErrorKind::Custom(format!(
"Missing shred for slot {}, index {}",
slot, i
)),
)));
if slot > self.lowest_cleanup_slot() {
panic!(
"Shred with
slot: {},
index: {},
consumed: {},
completed_indexes: {:?}
must exist if shred index was included in a range: {} {}",
slot,
i,
slot_meta.consumed,
slot_meta.completed_data_indexes,
start_index,
end_index
);
}
}
return Err(BlockstoreError::InvalidShredData(Box::new(
bincode::ErrorKind::Custom(format!(
"Missing shred for slot {}, index {}",
slot, i
)),
)));
}

Shred::new_from_serialized_shred(serialized_shred.unwrap()).map_err(|err| {
Expand Down