Start replay stage from the slot-relative blob index, not the global entry height
This commit is contained in:
@ -123,6 +123,7 @@ pub struct BankForksInfo {
|
|||||||
pub bank_id: u64,
|
pub bank_id: u64,
|
||||||
pub entry_height: u64,
|
pub entry_height: u64,
|
||||||
pub last_entry_id: Hash,
|
pub last_entry_id: Hash,
|
||||||
|
pub next_blob_index: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_blocktree(
|
pub fn process_blocktree(
|
||||||
@ -166,7 +167,6 @@ pub fn process_blocktree(
|
|||||||
BankError::LedgerVerificationFailed
|
BankError::LedgerVerificationFailed
|
||||||
})?
|
})?
|
||||||
.unwrap();
|
.unwrap();
|
||||||
trace!("processing slot {:?}, meta={:?}", slot, meta);
|
|
||||||
|
|
||||||
// Fetch all entries for this slot
|
// Fetch all entries for this slot
|
||||||
let mut entries = blocktree.get_slot_entries(slot, 0, None).map_err(|err| {
|
let mut entries = blocktree.get_slot_entries(slot, 0, None).map_err(|err| {
|
||||||
@ -210,11 +210,19 @@ pub fn process_blocktree(
|
|||||||
|
|
||||||
match meta.next_slots.len() {
|
match meta.next_slots.len() {
|
||||||
0 => {
|
0 => {
|
||||||
|
let next_blob_index = {
|
||||||
|
if meta.is_full() {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
meta.consumed
|
||||||
|
}
|
||||||
|
};
|
||||||
// Reached the end of this fork. Record the final entry height and last entry id
|
// Reached the end of this fork. Record the final entry height and last entry id
|
||||||
bank_forks_info.push(BankForksInfo {
|
bank_forks_info.push(BankForksInfo {
|
||||||
bank_id,
|
bank_id,
|
||||||
entry_height,
|
entry_height,
|
||||||
last_entry_id,
|
last_entry_id,
|
||||||
|
next_blob_index,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
1 => pending_slots.push((meta.next_slots[0], bank_id, entry_height, last_entry_id)),
|
1 => pending_slots.push((meta.next_slots[0], bank_id, entry_height, last_entry_id)),
|
||||||
@ -328,6 +336,7 @@ mod tests {
|
|||||||
bank_id: 2, // Fork 1 diverged with slot 2
|
bank_id: 2, // Fork 1 diverged with slot 2
|
||||||
entry_height: ticks_per_slot * 4,
|
entry_height: ticks_per_slot * 4,
|
||||||
last_entry_id: last_fork1_entry_id,
|
last_entry_id: last_fork1_entry_id,
|
||||||
|
next_blob_index: 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -336,6 +345,7 @@ mod tests {
|
|||||||
bank_id: 4, // Fork 2 diverged with slot 4
|
bank_id: 4, // Fork 2 diverged with slot 4
|
||||||
entry_height: ticks_per_slot * 3,
|
entry_height: ticks_per_slot * 3,
|
||||||
last_entry_id: last_fork2_entry_id,
|
last_entry_id: last_fork2_entry_id,
|
||||||
|
next_blob_index: 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -454,6 +464,7 @@ mod tests {
|
|||||||
bank_id: 0,
|
bank_id: 0,
|
||||||
entry_height,
|
entry_height,
|
||||||
last_entry_id,
|
last_entry_id,
|
||||||
|
next_blob_index: entry_height,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ impl ReplayStage {
|
|||||||
bank,
|
bank,
|
||||||
tick_height,
|
tick_height,
|
||||||
bank_forks_info[0].last_entry_id,
|
bank_forks_info[0].last_entry_id,
|
||||||
bank_forks_info[0].entry_height,
|
bank_forks_info[0].next_blob_index,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,6 +226,7 @@ pub mod tests {
|
|||||||
bank_id: 0,
|
bank_id: 0,
|
||||||
entry_height: 0,
|
entry_height: 0,
|
||||||
last_entry_id: Hash::default(),
|
last_entry_id: Hash::default(),
|
||||||
|
next_blob_index: 0,
|
||||||
}];
|
}];
|
||||||
let leader_scheduler = LeaderScheduler::new_with_bank(&bank_forks.working_bank());
|
let leader_scheduler = LeaderScheduler::new_with_bank(&bank_forks.working_bank());
|
||||||
let leader_scheduler = Arc::new(RwLock::new(leader_scheduler));
|
let leader_scheduler = Arc::new(RwLock::new(leader_scheduler));
|
||||||
|
@ -90,6 +90,7 @@ fn test_replay() {
|
|||||||
bank_id: 0,
|
bank_id: 0,
|
||||||
entry_height: 0,
|
entry_height: 0,
|
||||||
last_entry_id: cur_hash,
|
last_entry_id: cur_hash,
|
||||||
|
next_blob_index: 0,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
let bank = bank_forks.working_bank();
|
let bank = bank_forks.working_bank();
|
||||||
|
Reference in New Issue
Block a user