restore timestamp() in find_missing_indexes (#30345)

This commit is contained in:
Jeff Biseda 2023-02-15 16:12:36 -08:00 committed by GitHub
parent 5680c76c86
commit 20614fa746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 109 deletions

View File

@ -114,7 +114,6 @@ pub fn get_closest_completion(
slot_meta_cache: &mut HashMap<Slot, Option<SlotMeta>>, slot_meta_cache: &mut HashMap<Slot, Option<SlotMeta>>,
processed_slots: &mut HashSet<Slot>, processed_slots: &mut HashSet<Slot>,
limit: usize, limit: usize,
now_timestamp: u64,
) -> Vec<ShredRepairType> { ) -> Vec<ShredRepairType> {
let mut v: Vec<(Slot, u64)> = Vec::default(); let mut v: Vec<(Slot, u64)> = Vec::default();
let iter = GenericTraversal::new(tree); let iter = GenericTraversal::new(tree);
@ -188,7 +187,6 @@ pub fn get_closest_completion(
slot, slot,
slot_meta, slot_meta,
limit - repairs.len(), limit - repairs.len(),
now_timestamp,
); );
repairs.extend(new_repairs); repairs.extend(new_repairs);
} }
@ -201,9 +199,9 @@ pub fn get_closest_completion(
pub mod test { pub mod test {
use { use {
super::*, super::*,
crate::repair_service::post_shred_deferment_timestamp, crate::repair_service::sleep_shred_deferment_period,
solana_ledger::{blockstore::Blockstore, get_tmp_ledger_path}, solana_ledger::{blockstore::Blockstore, get_tmp_ledger_path},
solana_sdk::{hash::Hash, timing::timestamp}, solana_sdk::hash::Hash,
trees::{tr, Tree, TreeWalk}, trees::{tr, Tree, TreeWalk},
}; };
@ -240,7 +238,6 @@ pub mod test {
&mut slot_meta_cache, &mut slot_meta_cache,
&mut processed_slots, &mut processed_slots,
10, 10,
timestamp(),
); );
assert_eq!(repairs, []); assert_eq!(repairs, []);
@ -258,13 +255,13 @@ pub mod test {
let heaviest_subtree_fork_choice = HeaviestSubtreeForkChoice::new_from_tree(forks); let heaviest_subtree_fork_choice = HeaviestSubtreeForkChoice::new_from_tree(forks);
let mut slot_meta_cache = HashMap::default(); let mut slot_meta_cache = HashMap::default();
let mut processed_slots = HashSet::default(); let mut processed_slots = HashSet::default();
sleep_shred_deferment_period();
let repairs = get_closest_completion( let repairs = get_closest_completion(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
&mut slot_meta_cache, &mut slot_meta_cache,
&mut processed_slots, &mut processed_slots,
2, 2,
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,

View File

@ -353,7 +353,6 @@ impl RepairService {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&duplicate_slot_repair_statuses, &duplicate_slot_repair_statuses,
timestamp(),
&mut repair_timing, &mut repair_timing,
&mut best_repairs_stats, &mut best_repairs_stats,
); );
@ -530,7 +529,6 @@ impl RepairService {
slot: Slot, slot: Slot,
slot_meta: &SlotMeta, slot_meta: &SlotMeta,
max_repairs: usize, max_repairs: usize,
now_timestamp: u64,
) -> Vec<ShredRepairType> { ) -> Vec<ShredRepairType> {
if max_repairs == 0 || slot_meta.is_full() { if max_repairs == 0 || slot_meta.is_full() {
vec![] vec![]
@ -543,8 +541,9 @@ impl RepairService {
.and_then(|shred| shred::layout::get_reference_tick(&shred).ok()) .and_then(|shred| shred::layout::get_reference_tick(&shred).ok())
.map(u64::from) .map(u64::from)
{ {
// System time is not monotonic
let ticks_since_first_insert = DEFAULT_TICKS_PER_SECOND let ticks_since_first_insert = DEFAULT_TICKS_PER_SECOND
* now_timestamp.saturating_sub(slot_meta.first_shred_timestamp) * timestamp().saturating_sub(slot_meta.first_shred_timestamp)
/ 1_000; / 1_000;
if ticks_since_first_insert if ticks_since_first_insert
< reference_tick.saturating_add(DEFER_REPAIR_THRESHOLD_TICKS) < reference_tick.saturating_add(DEFER_REPAIR_THRESHOLD_TICKS)
@ -557,7 +556,6 @@ impl RepairService {
blockstore blockstore
.find_missing_data_indexes( .find_missing_data_indexes(
slot, slot,
now_timestamp,
slot_meta.first_shred_timestamp, slot_meta.first_shred_timestamp,
DEFER_REPAIR_THRESHOLD_TICKS, DEFER_REPAIR_THRESHOLD_TICKS,
slot_meta.consumed, slot_meta.consumed,
@ -577,7 +575,6 @@ impl RepairService {
max_repairs: usize, max_repairs: usize,
slot: Slot, slot: Slot,
duplicate_slot_repair_statuses: &impl Contains<'a, Slot>, duplicate_slot_repair_statuses: &impl Contains<'a, Slot>,
now_timestamp: u64,
) { ) {
let mut pending_slots = vec![slot]; let mut pending_slots = vec![slot];
while repairs.len() < max_repairs && !pending_slots.is_empty() { while repairs.len() < max_repairs && !pending_slots.is_empty() {
@ -592,7 +589,6 @@ impl RepairService {
slot, slot,
&slot_meta, &slot_meta,
max_repairs - repairs.len(), max_repairs - repairs.len(),
now_timestamp,
); );
repairs.extend(new_repairs); repairs.extend(new_repairs);
let next_slots = slot_meta.next_slots; let next_slots = slot_meta.next_slots;
@ -609,7 +605,6 @@ impl RepairService {
blockstore: &Blockstore, blockstore: &Blockstore,
max_repairs: usize, max_repairs: usize,
repair_range: &RepairSlotRange, repair_range: &RepairSlotRange,
now_timestamp: u64,
) -> crate::result::Result<Vec<ShredRepairType>> { ) -> crate::result::Result<Vec<ShredRepairType>> {
// Slot height and shred indexes for shreds we want to repair // Slot height and shred indexes for shreds we want to repair
let mut repairs: Vec<ShredRepairType> = vec![]; let mut repairs: Vec<ShredRepairType> = vec![];
@ -631,7 +626,6 @@ impl RepairService {
slot, slot,
&meta, &meta,
max_repairs - repairs.len(), max_repairs - repairs.len(),
now_timestamp,
); );
repairs.extend(new_repairs); repairs.extend(new_repairs);
} }
@ -654,7 +648,6 @@ impl RepairService {
slot, slot,
&slot_meta, &slot_meta,
MAX_REPAIR_PER_DUPLICATE, MAX_REPAIR_PER_DUPLICATE,
timestamp(),
)) ))
} }
} else { } else {
@ -795,9 +788,11 @@ impl RepairService {
} }
#[cfg(test)] #[cfg(test)]
pub(crate) fn post_shred_deferment_timestamp() -> u64 { pub(crate) fn sleep_shred_deferment_period() {
// adjust timestamp to bypass shred deferment window // sleep to bypass shred deferment window
timestamp() + DEFAULT_MS_PER_SLOT + DEFER_REPAIR_THRESHOLD.as_millis() as u64 sleep(Duration::from_millis(
DEFAULT_MS_PER_SLOT + DEFER_REPAIR_THRESHOLD.as_millis() as u64,
));
} }
#[cfg(test)] #[cfg(test)]
@ -850,7 +845,6 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
timestamp(),
&mut RepairTiming::default(), &mut RepairTiming::default(),
&mut BestRepairsStats::default(), &mut BestRepairsStats::default(),
), ),
@ -888,7 +882,6 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
timestamp(),
&mut RepairTiming::default(), &mut RepairTiming::default(),
&mut BestRepairsStats::default(), &mut BestRepairsStats::default(),
), ),
@ -939,6 +932,7 @@ mod test {
.collect(); .collect();
let mut repair_weight = RepairWeight::new(0); let mut repair_weight = RepairWeight::new(0);
sleep_shred_deferment_period();
assert_eq!( assert_eq!(
repair_weight.get_best_weighted_repairs( repair_weight.get_best_weighted_repairs(
&blockstore, &blockstore,
@ -949,7 +943,6 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
&mut RepairTiming::default(), &mut RepairTiming::default(),
&mut BestRepairsStats::default(), &mut BestRepairsStats::default(),
), ),
@ -966,7 +959,6 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
&mut RepairTiming::default(), &mut RepairTiming::default(),
&mut BestRepairsStats::default(), &mut BestRepairsStats::default(),
)[..], )[..],
@ -1002,6 +994,7 @@ mod test {
let expected: Vec<ShredRepairType> = let expected: Vec<ShredRepairType> =
vec![ShredRepairType::HighestShred(0, num_shreds_per_slot - 1)]; vec![ShredRepairType::HighestShred(0, num_shreds_per_slot - 1)];
sleep_shred_deferment_period();
let mut repair_weight = RepairWeight::new(0); let mut repair_weight = RepairWeight::new(0);
assert_eq!( assert_eq!(
repair_weight.get_best_weighted_repairs( repair_weight.get_best_weighted_repairs(
@ -1013,7 +1006,6 @@ mod test {
MAX_UNKNOWN_LAST_INDEX_REPAIRS, MAX_UNKNOWN_LAST_INDEX_REPAIRS,
MAX_CLOSEST_COMPLETION_REPAIRS, MAX_CLOSEST_COMPLETION_REPAIRS,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
&mut RepairTiming::default(), &mut RepairTiming::default(),
&mut BestRepairsStats::default(), &mut BestRepairsStats::default(),
), ),
@ -1057,12 +1049,12 @@ mod test {
}) })
.collect(); .collect();
sleep_shred_deferment_period();
assert_eq!( assert_eq!(
RepairService::generate_repairs_in_range( RepairService::generate_repairs_in_range(
&blockstore, &blockstore,
std::usize::MAX, std::usize::MAX,
&repair_slot_range, &repair_slot_range,
post_shred_deferment_timestamp(),
) )
.unwrap(), .unwrap(),
expected expected
@ -1111,7 +1103,6 @@ mod test {
&blockstore, &blockstore,
std::usize::MAX, std::usize::MAX,
&repair_slot_range, &repair_slot_range,
timestamp(),
) )
.unwrap(), .unwrap(),
expected expected

View File

@ -157,7 +157,6 @@ impl RepairWeight {
max_unknown_last_index_repairs: usize, max_unknown_last_index_repairs: usize,
max_closest_completion_repairs: usize, max_closest_completion_repairs: usize,
ignore_slots: &impl Contains<'a, Slot>, ignore_slots: &impl Contains<'a, Slot>,
now_timestamp: u64,
repair_timing: &mut RepairTiming, repair_timing: &mut RepairTiming,
stats: &mut BestRepairsStats, stats: &mut BestRepairsStats,
) -> Vec<ShredRepairType> { ) -> Vec<ShredRepairType> {
@ -188,7 +187,6 @@ impl RepairWeight {
&mut best_shreds_repairs, &mut best_shreds_repairs,
max_new_shreds, max_new_shreds,
ignore_slots, ignore_slots,
now_timestamp,
); );
let num_best_shreds_repairs = best_shreds_repairs.len(); let num_best_shreds_repairs = best_shreds_repairs.len();
let repair_slots_set: HashSet<Slot> = let repair_slots_set: HashSet<Slot> =
@ -223,7 +221,6 @@ impl RepairWeight {
&mut slot_meta_cache, &mut slot_meta_cache,
&mut processed_slots, &mut processed_slots,
max_closest_completion_repairs, max_closest_completion_repairs,
now_timestamp,
); );
let num_closest_completion_repairs = closest_completion_repairs.len(); let num_closest_completion_repairs = closest_completion_repairs.len();
let num_closest_completion_slots = processed_slots.len() - pre_num_slots; let num_closest_completion_slots = processed_slots.len() - pre_num_slots;
@ -353,7 +350,6 @@ impl RepairWeight {
repairs: &mut Vec<ShredRepairType>, repairs: &mut Vec<ShredRepairType>,
max_new_shreds: usize, max_new_shreds: usize,
ignore_slots: &impl Contains<'a, Slot>, ignore_slots: &impl Contains<'a, Slot>,
now_timestamp: u64,
) { ) {
let root_tree = self.trees.get(&self.root).expect("Root tree must exist"); let root_tree = self.trees.get(&self.root).expect("Root tree must exist");
repair_weighted_traversal::get_best_repair_shreds( repair_weighted_traversal::get_best_repair_shreds(
@ -363,7 +359,6 @@ impl RepairWeight {
repairs, repairs,
max_new_shreds, max_new_shreds,
ignore_slots, ignore_slots,
now_timestamp,
); );
} }
@ -472,7 +467,6 @@ impl RepairWeight {
slot_meta_cache: &mut HashMap<Slot, Option<SlotMeta>>, slot_meta_cache: &mut HashMap<Slot, Option<SlotMeta>>,
processed_slots: &mut HashSet<Slot>, processed_slots: &mut HashSet<Slot>,
max_new_repairs: usize, max_new_repairs: usize,
now_timestamp: u64,
) -> Vec<ShredRepairType> { ) -> Vec<ShredRepairType> {
let mut repairs = Vec::default(); let mut repairs = Vec::default();
for (_slot, tree) in self.trees.iter() { for (_slot, tree) in self.trees.iter() {
@ -485,7 +479,6 @@ impl RepairWeight {
slot_meta_cache, slot_meta_cache,
processed_slots, processed_slots,
max_new_repairs - repairs.len(), max_new_repairs - repairs.len(),
now_timestamp,
); );
repairs.extend(new_repairs); repairs.extend(new_repairs);
} }

View File

@ -80,7 +80,6 @@ pub fn get_best_repair_shreds<'a>(
repairs: &mut Vec<ShredRepairType>, repairs: &mut Vec<ShredRepairType>,
max_new_shreds: usize, max_new_shreds: usize,
ignore_slots: &impl Contains<'a, Slot>, ignore_slots: &impl Contains<'a, Slot>,
now_timestamp: u64,
) { ) {
let initial_len = repairs.len(); let initial_len = repairs.len();
let max_repairs = initial_len + max_new_shreds; let max_repairs = initial_len + max_new_shreds;
@ -107,7 +106,6 @@ pub fn get_best_repair_shreds<'a>(
slot, slot,
slot_meta, slot_meta,
max_repairs - repairs.len(), max_repairs - repairs.len(),
now_timestamp,
); );
repairs.extend(new_repairs); repairs.extend(new_repairs);
} }
@ -129,7 +127,6 @@ pub fn get_best_repair_shreds<'a>(
max_repairs, max_repairs,
*new_child_slot, *new_child_slot,
ignore_slots, ignore_slots,
now_timestamp,
); );
} }
visited_set.insert(*new_child_slot); visited_set.insert(*new_child_slot);
@ -144,13 +141,13 @@ pub fn get_best_repair_shreds<'a>(
pub mod test { pub mod test {
use { use {
super::*, super::*,
crate::repair_service::post_shred_deferment_timestamp, crate::repair_service::sleep_shred_deferment_period,
solana_ledger::{ solana_ledger::{
get_tmp_ledger_path, get_tmp_ledger_path,
shred::{Shred, ShredFlags}, shred::{Shred, ShredFlags},
}, },
solana_runtime::bank_utils, solana_runtime::bank_utils,
solana_sdk::{hash::Hash, timing::timestamp}, solana_sdk::hash::Hash,
trees::tr, trees::tr,
}; };
@ -230,6 +227,7 @@ pub mod test {
let mut slot_meta_cache = HashMap::default(); let mut slot_meta_cache = HashMap::default();
let last_shred = blockstore.meta(0).unwrap().unwrap().received; let last_shred = blockstore.meta(0).unwrap().unwrap().received;
sleep_shred_deferment_period();
get_best_repair_shreds( get_best_repair_shreds(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
@ -237,18 +235,6 @@ pub mod test {
&mut repairs, &mut repairs,
6, 6,
&HashSet::default(), &HashSet::default(),
timestamp().saturating_sub(1_000 * 60), // ensure deferment
);
assert_eq!(repairs, vec![]);
get_best_repair_shreds(
&heaviest_subtree_fork_choice,
&blockstore,
&mut slot_meta_cache,
&mut repairs,
6,
&HashSet::default(),
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -271,6 +257,7 @@ pub mod test {
2, 2,
Hash::default(), Hash::default(),
); );
sleep_shred_deferment_period();
get_best_repair_shreds( get_best_repair_shreds(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
@ -278,7 +265,6 @@ pub mod test {
&mut repairs, &mut repairs,
6, 6,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -312,6 +298,7 @@ pub mod test {
blockstore blockstore
.insert_shreds(completed_shreds, None, false) .insert_shreds(completed_shreds, None, false)
.unwrap(); .unwrap();
sleep_shred_deferment_period();
get_best_repair_shreds( get_best_repair_shreds(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
@ -319,7 +306,6 @@ pub mod test {
&mut repairs, &mut repairs,
4, 4,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -334,6 +320,7 @@ pub mod test {
repairs = vec![]; repairs = vec![];
slot_meta_cache = HashMap::default(); slot_meta_cache = HashMap::default();
blockstore.add_tree(tr(2) / (tr(8)), true, false, 2, Hash::default()); blockstore.add_tree(tr(2) / (tr(8)), true, false, 2, Hash::default());
sleep_shred_deferment_period();
get_best_repair_shreds( get_best_repair_shreds(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
@ -341,7 +328,6 @@ pub mod test {
&mut repairs, &mut repairs,
4, 4,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -359,6 +345,7 @@ pub mod test {
// 4 again when the Unvisited(2) event happens // 4 again when the Unvisited(2) event happens
blockstore.add_tree(tr(2) / (tr(6) / tr(7)), true, false, 2, Hash::default()); blockstore.add_tree(tr(2) / (tr(6) / tr(7)), true, false, 2, Hash::default());
sleep_shred_deferment_period();
let mut repairs = vec![]; let mut repairs = vec![];
let mut slot_meta_cache = HashMap::default(); let mut slot_meta_cache = HashMap::default();
get_best_repair_shreds( get_best_repair_shreds(
@ -368,7 +355,6 @@ pub mod test {
&mut repairs, &mut repairs,
std::usize::MAX, std::usize::MAX,
&HashSet::default(), &HashSet::default(),
post_shred_deferment_timestamp(),
); );
let last_shred = blockstore.meta(0).unwrap().unwrap().received; let last_shred = blockstore.meta(0).unwrap().unwrap().received;
assert_eq!( assert_eq!(
@ -383,6 +369,7 @@ pub mod test {
#[test] #[test]
fn test_get_best_repair_shreds_ignore() { fn test_get_best_repair_shreds_ignore() {
let (blockstore, heaviest_subtree_fork_choice) = setup_forks(); let (blockstore, heaviest_subtree_fork_choice) = setup_forks();
sleep_shred_deferment_period();
// Adding slots to ignore should remove them from the repair set, but // Adding slots to ignore should remove them from the repair set, but
// should not remove their children // should not remove their children
@ -397,7 +384,6 @@ pub mod test {
&mut repairs, &mut repairs,
std::usize::MAX, std::usize::MAX,
&ignore_set, &ignore_set,
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -413,6 +399,7 @@ pub mod test {
slot_meta_cache = HashMap::default(); slot_meta_cache = HashMap::default();
blockstore.add_tree(tr(2) / (tr(6) / tr(7)), true, false, 2, Hash::default()); blockstore.add_tree(tr(2) / (tr(6) / tr(7)), true, false, 2, Hash::default());
ignore_set.insert(2); ignore_set.insert(2);
sleep_shred_deferment_period();
get_best_repair_shreds( get_best_repair_shreds(
&heaviest_subtree_fork_choice, &heaviest_subtree_fork_choice,
&blockstore, &blockstore,
@ -420,7 +407,6 @@ pub mod test {
&mut repairs, &mut repairs,
std::usize::MAX, std::usize::MAX,
&ignore_set, &ignore_set,
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,
@ -442,7 +428,6 @@ pub mod test {
&mut repairs, &mut repairs,
std::usize::MAX, std::usize::MAX,
&ignore_set, &ignore_set,
post_shred_deferment_timestamp(),
); );
assert_eq!( assert_eq!(
repairs, repairs,

View File

@ -1801,7 +1801,6 @@ impl Blockstore {
fn find_missing_indexes<C>( fn find_missing_indexes<C>(
db_iterator: &mut DBRawIterator, db_iterator: &mut DBRawIterator,
slot: Slot, slot: Slot,
now_timestamp: u64,
first_timestamp: u64, first_timestamp: u64,
defer_threshold_ticks: u64, defer_threshold_ticks: u64,
start_index: u64, start_index: u64,
@ -1816,8 +1815,9 @@ impl Blockstore {
} }
let mut missing_indexes = vec![]; let mut missing_indexes = vec![];
// System time is not monotonic
let ticks_since_first_insert = let ticks_since_first_insert =
DEFAULT_TICKS_PER_SECOND * (now_timestamp - first_timestamp) / 1000; DEFAULT_TICKS_PER_SECOND * timestamp().saturating_sub(first_timestamp) / 1000;
// Seek to the first shred with index >= start_index // Seek to the first shred with index >= start_index
db_iterator.seek(&C::key((slot, start_index))); db_iterator.seek(&C::key((slot, start_index)));
@ -1877,7 +1877,6 @@ impl Blockstore {
pub fn find_missing_data_indexes( pub fn find_missing_data_indexes(
&self, &self,
slot: Slot, slot: Slot,
now_timestamp: u64,
first_timestamp: u64, first_timestamp: u64,
defer_threshold_ticks: u64, defer_threshold_ticks: u64,
start_index: u64, start_index: u64,
@ -1891,7 +1890,6 @@ impl Blockstore {
Self::find_missing_indexes::<cf::ShredData>( Self::find_missing_indexes::<cf::ShredData>(
&mut db_iterator, &mut db_iterator,
slot, slot,
now_timestamp,
first_timestamp, first_timestamp,
defer_threshold_ticks, defer_threshold_ticks,
start_index, start_index,
@ -5916,7 +5914,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -5928,7 +5925,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
1, // start_index 1, // start_index
@ -5940,7 +5936,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestmap 0, // first_timestmap
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -5952,7 +5947,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestmap 0, // first_timestmap
0, // defer_threshold_ticks 0, // defer_threshold_ticks
gap - 2, // start_index gap - 2, // start_index
@ -5963,8 +5957,7 @@ pub mod tests {
); );
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
gap - 2, // start_index gap - 2, // start_index
@ -5975,13 +5968,12 @@ pub mod tests {
); );
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(), 0, // first_timestamp
0, // first_timestamp 0, // defer_threshold_ticks
0, // defer_threshold_ticks 0, // start_index
0, // start_index gap, // end_index
gap, // end_index 1, // max_missing
1, // max_missing
), ),
vec![1], vec![1],
); );
@ -5993,7 +5985,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -6005,7 +5996,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -6027,7 +6017,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
j * gap, // start_index j * gap, // start_index
@ -6068,7 +6057,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
timestamp(), // first_timestamp timestamp(), // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -6081,7 +6069,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
timestamp() - 400, // first_timestamp timestamp() - 400, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
0, // start_index 0, // start_index
@ -6103,49 +6090,45 @@ pub mod tests {
let empty: Vec<u64> = vec![]; let empty: Vec<u64> = vec![];
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(), 0, // first_timestamp
0, // first_timestamp 0, // defer_threshold_ticks
0, // defer_threshold_ticks 0, // start_index
0, // start_index 0, // end_index
0, // end_index 1, // max_missing
1, // max_missing
), ),
empty empty
); );
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(), 0, // first_timestamp
0, // first_timestamp 0, // defer_threshold_ticks
0, // defer_threshold_ticks 5, // start_index
5, // start_index 5, // end_index
5, // end_index 1, // max_missing
1, // max_missing
), ),
empty empty
); );
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(), 0, // first_timestamp
0, // first_timestamp 0, // defer_threshold_ticks
0, // defer_threshold_ticks 4, // start_index
4, // start_index 3, // end_index
3, // end_index 1, // max_missing
1, // max_missing
), ),
empty empty
); );
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(), 0, // first_timestamp
0, // first_timestamp 0, // defer_threshold_ticks
0, // defer_threshold_ticks 1, // start_index
1, // start_index 2, // end_index
2, // end_index 0, // max_missing
0, // max_missing
), ),
empty empty
); );
@ -6173,8 +6156,7 @@ pub mod tests {
// [i, first_index - 1] // [i, first_index - 1]
for start in 0..STARTS { for start in 0..STARTS {
let result = blockstore.find_missing_data_indexes( let result = blockstore.find_missing_data_indexes(
slot, slot, // slot
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
start, // start_index start, // start_index
@ -6207,7 +6189,6 @@ pub mod tests {
assert_eq!( assert_eq!(
blockstore.find_missing_data_indexes( blockstore.find_missing_data_indexes(
slot, slot,
timestamp(),
0, // first_timestamp 0, // first_timestamp
0, // defer_threshold_ticks 0, // defer_threshold_ticks
j, // start_index j, // start_index