retains hash value of outdated responses received from pull requests (#12513)
pull_response_fail_inserts has been increasing: https://cdn.discordapp.com/attachments/478692221441409024/759096187587657778/pull_response_fail_insert.png but for outdated values which fail to insert: https://github.com/solana-labs/solana/blob/a5c3fc14b3/core/src/crds_gossip_pull.rs#L332-L344 https://github.com/solana-labs/solana/blob/a5c3fc14b3/core/src/crds.rs#L104-L108 are not recorded anywhere, and so the next pull request may obtain the same redundant payload again, unnecessary taking bandwidth. This commit holds on to the hashes of failed-inserts for a while, similar to purged_values: https://github.com/solana-labs/solana/blob/a5c3fc14b3/core/src/crds_gossip_pull.rs#L380 and filter them out for the next pull request: https://github.com/solana-labs/solana/blob/a5c3fc14b3/core/src/crds_gossip_pull.rs#L204
This commit is contained in:
@@ -105,19 +105,13 @@ impl Crds {
|
||||
&self,
|
||||
value: CrdsValue,
|
||||
local_timestamp: u64,
|
||||
) -> Option<VersionedCrdsValue> {
|
||||
) -> (bool, VersionedCrdsValue) {
|
||||
let new_value = self.new_versioned(local_timestamp, value);
|
||||
let label = new_value.value.label();
|
||||
let would_insert = self
|
||||
.table
|
||||
.get(&label)
|
||||
.map(|current| new_value > *current)
|
||||
.unwrap_or(true);
|
||||
if would_insert {
|
||||
Some(new_value)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
// New value is outdated and fails to insert, if it already exists in
|
||||
// the table with a more recent wallclock.
|
||||
let outdated = matches!(self.table.get(&label), Some(current) if new_value <= *current);
|
||||
(!outdated, new_value)
|
||||
}
|
||||
/// insert the new value, returns the old value if insert succeeds
|
||||
pub fn insert_versioned(
|
||||
|
Reference in New Issue
Block a user