adds metrics for num merkle shreds on the receiving end (#29710)
This commit is contained in:
parent
d4ce59eee7
commit
5b5a3ebce8
|
@ -19,7 +19,6 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_LRU_SIZE: usize = 10_000;
|
const DEFAULT_LRU_SIZE: usize = 10_000;
|
||||||
type ShredsReceived = LruCache<u64, ()>;
|
|
||||||
|
|
||||||
pub(crate) struct ShredFetchStage {
|
pub(crate) struct ShredFetchStage {
|
||||||
thread_hdls: Vec<JoinHandle<()>>,
|
thread_hdls: Vec<JoinHandle<()>>,
|
||||||
|
@ -229,7 +228,7 @@ fn should_discard_packet(
|
||||||
max_slot: Slot, // Max slot to ingest shreds for.
|
max_slot: Slot, // Max slot to ingest shreds for.
|
||||||
shred_version: u16,
|
shred_version: u16,
|
||||||
packet_hasher: &PacketHasher,
|
packet_hasher: &PacketHasher,
|
||||||
shreds_received: &mut ShredsReceived,
|
shreds_received: &mut LruCache<u64, ()>,
|
||||||
stats: &mut ShredFetchStats,
|
stats: &mut ShredFetchStats,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if should_discard_shred(packet, root, max_slot, shred_version, stats) {
|
if should_discard_shred(packet, root, max_slot, shred_version, stats) {
|
||||||
|
|
|
@ -912,8 +912,8 @@ pub fn should_discard_shred(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let shred_type = match layout::get_shred_type(shred) {
|
let shred_variant = match layout::get_shred_variant(shred) {
|
||||||
Ok(shred_type) => shred_type,
|
Ok(shred_variant) => shred_variant,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
stats.bad_shred_type += 1;
|
stats.bad_shred_type += 1;
|
||||||
return true;
|
return true;
|
||||||
|
@ -939,7 +939,7 @@ pub fn should_discard_shred(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match shred_type {
|
match ShredType::from(shred_variant) {
|
||||||
ShredType::Code => {
|
ShredType::Code => {
|
||||||
if index >= shred_code::MAX_CODE_SHREDS_PER_SLOT as u32 {
|
if index >= shred_code::MAX_CODE_SHREDS_PER_SLOT as u32 {
|
||||||
stats.index_out_of_bounds += 1;
|
stats.index_out_of_bounds += 1;
|
||||||
|
@ -975,6 +975,15 @@ pub fn should_discard_shred(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
match shred_variant {
|
||||||
|
ShredVariant::LegacyCode | ShredVariant::LegacyData => (),
|
||||||
|
ShredVariant::MerkleCode(_) => {
|
||||||
|
stats.num_shreds_merkle_code = stats.num_shreds_merkle_code.saturating_add(1);
|
||||||
|
}
|
||||||
|
ShredVariant::MerkleData(_) => {
|
||||||
|
stats.num_shreds_merkle_data = stats.num_shreds_merkle_data.saturating_add(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ pub struct ProcessShredsStats {
|
||||||
pub struct ShredFetchStats {
|
pub struct ShredFetchStats {
|
||||||
pub index_overrun: usize,
|
pub index_overrun: usize,
|
||||||
pub shred_count: usize,
|
pub shred_count: usize,
|
||||||
|
pub(crate) num_shreds_merkle_code: usize,
|
||||||
|
pub(crate) num_shreds_merkle_data: usize,
|
||||||
pub ping_count: usize,
|
pub ping_count: usize,
|
||||||
pub ping_err_verify_count: usize,
|
pub ping_err_verify_count: usize,
|
||||||
pub(crate) index_bad_deserialize: usize,
|
pub(crate) index_bad_deserialize: usize,
|
||||||
|
@ -115,6 +117,8 @@ impl ShredFetchStats {
|
||||||
name,
|
name,
|
||||||
("index_overrun", self.index_overrun, i64),
|
("index_overrun", self.index_overrun, i64),
|
||||||
("shred_count", self.shred_count, i64),
|
("shred_count", self.shred_count, i64),
|
||||||
|
("num_shreds_merkle_code", self.num_shreds_merkle_code, i64),
|
||||||
|
("num_shreds_merkle_data", self.num_shreds_merkle_data, i64),
|
||||||
("ping_count", self.ping_count, i64),
|
("ping_count", self.ping_count, i64),
|
||||||
("ping_err_verify_count", self.ping_err_verify_count, i64),
|
("ping_err_verify_count", self.ping_err_verify_count, i64),
|
||||||
("slot_bad_deserialize", self.slot_bad_deserialize, i64),
|
("slot_bad_deserialize", self.slot_bad_deserialize, i64),
|
||||||
|
|
Loading…
Reference in New Issue