Window service is filtering out coding shreds (#6052)

* Window service is filtering out coding shreds

* update erasure stats to indicate recovery count

* filter out outdated coding shreds

* address review comments
This commit is contained in:
Pankaj Garg 2019-09-24 12:25:25 -07:00 committed by GitHub
parent d7e4c8e3cf
commit 3ed34b571c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -396,7 +396,7 @@ impl Blocktree {
set_index as usize,
slot,
) {
submit_metrics(true, "complete".into());
submit_metrics(true, format!("complete. recovered: {}", result.len()));
recovered_data_shreds.append(&mut result);
} else {
submit_metrics(true, "incomplete".into());

View File

@ -25,6 +25,16 @@ use std::time::{Duration, Instant};
pub const NUM_THREADS: u32 = 10;
fn verify_shred_slot(shred: &Shred, root: u64) -> bool {
if shred.is_data() {
// Only data shreds have parent information
blocktree::verify_shred_slots(shred.slot(), shred.parent(), root)
} else {
// Filter out outdated coding shreds
shred.slot() >= root
}
}
/// drop blobs that are from myself or not from the correct leader for the
/// blob's slot
pub fn should_retransmit_and_persist(
@ -42,7 +52,7 @@ pub fn should_retransmit_and_persist(
if leader_id == *my_pubkey {
inc_new_counter_debug!("streamer-recv_window-circular_transmission", 1);
false
} else if !blocktree::verify_shred_slots(shred.slot(), shred.parent(), root) {
} else if !verify_shred_slot(shred, root) {
inc_new_counter_debug!("streamer-recv_window-outdated_transmission", 1);
false
} else if !shred.verify(&leader_id) {