Remove obsoleted return value from Blockstore insert shred method (#28992)

This commit is contained in:
steviez 2022-12-01 11:17:46 -06:00 committed by GitHub
parent ae57a14ef6
commit 3c42c87098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 20 deletions

View File

@ -276,7 +276,7 @@ where
prune_shreds_elapsed.stop();
ws_metrics.prune_shreds_elapsed_us += prune_shreds_elapsed.as_us();
let (completed_data_sets, _) = blockstore.insert_shreds_handle_duplicate(
let completed_data_sets = blockstore.insert_shreds_handle_duplicate(
shreds,
repairs,
Some(leader_schedule_cache),

View File

@ -459,12 +459,16 @@ mod tests {
}
let len = batch_id;
let br = if pre_generate_data {
// No duplicates being generated, so all shreds
// being passed to insert() are getting inserted
let num_shred_inserted = if pre_generate_data {
let mut sl = cloned_shreds.lock().unwrap();
if let Some(shreds_from_queue) = sl.pop_front() {
total += shreds_from_queue.len();
let num_shreds = shreds_from_queue.len();
total += num_shreds;
cloned_blockstore.insert_shreds(
shreds_from_queue, None, false).unwrap()
shreds_from_queue, None, false).unwrap();
num_shreds
} else {
// If the queue is empty, we're done!
break;
@ -474,19 +478,23 @@ mod tests {
if slot_id > 0 {
let (shreds_with_parent, _) = make_many_slot_shreds(
slot_id, batch_size_slots, shreds_per_slot);
total += shreds_with_parent.len();
let num_shreds = shreds_with_parent.len();
total += num_shreds;
cloned_blockstore.insert_shreds(
shreds_with_parent.clone(), None, false).unwrap()
shreds_with_parent.clone(), None, false).unwrap();
num_shreds
} else {
total += first_shreds.len();
let num_shreds = first_shreds.len();
total += num_shreds;
cloned_blockstore.insert_shreds(
first_shreds.clone(), None, false).unwrap()
first_shreds.clone(), None, false).unwrap();
num_shreds
}
};
total_batches += 1;
total_inserted_shreds += br.1.len();
num_shreds += br.1.len();
total_inserted_shreds += num_shred_inserted;
num_shreds += num_shred_inserted;
shared_finished_count.fetch_add(1, Ordering::Relaxed);
// as_secs() returns whole number of seconds, so this runs every second

View File

@ -797,7 +797,7 @@ impl Blockstore {
handle_duplicate: &F,
reed_solomon_cache: &ReedSolomonCache,
metrics: &mut BlockstoreInsertionMetrics,
) -> Result<(Vec<CompletedDataSetInfo>, Vec<usize>)>
) -> Result<Vec<CompletedDataSetInfo>>
where
F: Fn(Shred),
{
@ -820,8 +820,7 @@ impl Blockstore {
let mut start = Measure::start("Shred insertion");
let mut index_meta_time_us = 0;
let mut newly_completed_data_sets: Vec<CompletedDataSetInfo> = vec![];
let mut inserted_indices = Vec::new();
for (i, (shred, is_repaired)) in shreds.into_iter().zip(is_repaired).enumerate() {
for (shred, is_repaired) in shreds.into_iter().zip(is_repaired) {
let shred_source = if is_repaired {
ShredSource::Repaired
} else {
@ -861,7 +860,6 @@ impl Blockstore {
metrics.num_repair += 1;
}
newly_completed_data_sets.extend(completed_data_sets);
inserted_indices.push(i);
metrics.num_inserted += 1;
}
};
@ -1007,7 +1005,7 @@ impl Blockstore {
metrics.total_elapsed_us += total_start.as_us();
metrics.index_meta_time_us += index_meta_time_us;
Ok((newly_completed_data_sets, inserted_indices))
Ok(newly_completed_data_sets)
}
pub fn add_new_shred_signal(&self, s: Sender<bool>) {
@ -1083,7 +1081,7 @@ impl Blockstore {
shreds: Vec<Shred>,
leader_schedule: Option<&LeaderScheduleCache>,
is_trusted: bool,
) -> Result<(Vec<CompletedDataSetInfo>, Vec<usize>)> {
) -> Result<Vec<CompletedDataSetInfo>> {
let shreds_len = shreds.len();
self.insert_shreds_handle_duplicate(
shreds,
@ -5093,13 +5091,11 @@ pub mod tests {
assert!(blockstore
.insert_shreds(shreds[1..].to_vec(), None, false)
.unwrap()
.0
.is_empty());
assert_eq!(
blockstore
.insert_shreds(vec![shreds[0].clone()], None, false)
.unwrap()
.0,
.unwrap(),
vec![CompletedDataSetInfo {
slot,
start_index: 0,
@ -5110,7 +5106,6 @@ pub mod tests {
assert!(blockstore
.insert_shreds(shreds, None, false)
.unwrap()
.0
.is_empty());
}