Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Skip requests with different version than ours
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge committed May 26, 2020
1 parent 7ebd8ee commit 5d20c3c
Showing 1 changed file with 49 additions and 5 deletions.
54 changes: 49 additions & 5 deletions core/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ struct GossipStats {
push_message: Counter,
new_pull_requests: Counter,
mark_pull_request: Counter,
skip_pull_response_shred_version: Counter,
skip_pull_shred_version: Counter,
skip_push_message_shred_version: Counter,
}

pub struct ClusterInfo {
Expand Down Expand Up @@ -1527,11 +1530,17 @@ impl ClusterInfo {
warn!("PullRequest ignored, I'm talking to myself");
inc_new_counter_debug!("cluster_info-window-request-loopback", 1);
} else {
gossip_pull_data.push(PullData {
from_addr,
caller,
filter,
});
if contact_info.shred_version == 0
|| contact_info.shred_version == me.my_shred_version()
{
gossip_pull_data.push(PullData {
from_addr,
caller,
filter,
});
} else {
me.stats.skip_pull_shred_version.add_relaxed(1);
}
}
}
datapoint_debug!(
Expand Down Expand Up @@ -1763,6 +1772,16 @@ impl ClusterInfo {
) {
let len = data.len();
trace!("PullResponse me: {} from: {} len={}", me.id, from, len);

if let Some(shred_version) = me.lookup_contact_info(from, |ci| ci.shred_version) {
if shred_version != 0 && shred_version != me.my_shred_version() {
me.stats
.skip_pull_response_shred_version
.add_relaxed(data.len() as u64);
return;
}
}

let (_fail, timeout_count) = me
.time_gossip_write_lock("process_pull", &me.stats.process_pull_response)
.process_pull_response(from, timeouts, data, timestamp());
Expand All @@ -1783,6 +1802,13 @@ impl ClusterInfo {
let self_id = me.id();
inc_new_counter_debug!("cluster_info-push_message", 1);

if let Some(shred_version) = me.lookup_contact_info(from, |ci| ci.shred_version) {
if shred_version != 0 && shred_version != me.my_shred_version() {
me.stats.skip_push_message_shred_version.add_relaxed(1);
return None;
}
}

let updated: Vec<_> = me
.time_gossip_write_lock("process_push", &me.stats.process_push_message)
.process_push_message(from, data, timestamp());
Expand Down Expand Up @@ -1974,6 +2000,24 @@ impl ClusterInfo {
i64
),
);
datapoint_info!(
"cluster_info_shred_version_skip",
(
"skip_push_message_shred_version",
self.stats.skip_push_message_shred_version.clear(),
i64
),
(
"skip_pull_response_shred_version",
self.stats.skip_pull_response_shred_version.clear(),
i64
),
(
"skip_pull_shred_version",
self.stats.skip_pull_shred_version.clear(),
i64
),
);

*last_print = Instant::now();
}
Expand Down

0 comments on commit 5d20c3c

Please sign in to comment.