Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0: removes early return if prune_messages are empty (backport of #3006) #3011

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Sep 27, 2024

Problem

Even if there are no outgoing prune messages we still need to generate outgoing push messages for packets just received, so the code should not early return here:
https://github.com/anza-xyz/agave/blob/d2cc71f0d/gossip/src/cluster_info.rs#L2400-L2402

Summary of Changes

removes early return if prune_messages are empty


This is an automatic backport of pull request #3006 done by Mergify.

@mergify mergify bot requested a review from a team as a code owner September 27, 2024 18:39
@behzadnouri behzadnouri added the automerge automerge Merge this Pull Request automatically once CI passes label Sep 27, 2024
Copy link
Author

mergify bot commented Sep 27, 2024

automerge label removed due to a CI failure

@mergify mergify bot removed the automerge automerge Merge this Pull Request automatically once CI passes label Sep 27, 2024
Even if there are no outgoing prune messages we still need to generate
outgoing push messages for packets just received, so the code should not
early return here:
https://github.com/anza-xyz/agave/blob/d2cc71f0d/gossip/src/cluster_info.rs#L2400-L2402

(cherry picked from commit ce15821)
@behzadnouri behzadnouri added the automerge automerge Merge this Pull Request automatically once CI passes label Sep 30, 2024
@@ -2444,7 +2441,9 @@ impl ClusterInfo {
self.stats
.packets_sent_push_messages_count
.add_relaxed((packet_batch.len() - num_prune_packets) as u64);
let _ = response_sender.send(packet_batch);
if !packet_batch.is_empty() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all the stats counter increases be surrounded by this if as well?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, not sure it matters much either way:

  • the stats counters are just doing an atomic add, and even if the argument is zero it wouldn't really have a measurable impact.
  • except for the prune counters, I would expect the other counters to be almost always non-zero anyways. i.e. we always push some messages out when receiving push messages.

Given that, I lean towards keeping the if branch shorter and simpler here. But if we decide to change that, because this is a backport, I would rather to do so on master branch first otherwise v2.0 becomes inconsistent with master.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming the question was asked wrt the metrics remaining accurate with this change?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metrics are accurate.
My understanding was that the comment was about avoiding metric.add_relaxed(0) which is a no-op.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, trying to avoid some wasted time on no-ops and make it match ping handling a little more closely https://github.com/anza-xyz/agave/blob/master/gossip/src/cluster_info.rs#L2561-L2571

But I don't see anything functionally wrong, and agree this isn't turning the needle on performance in any meaningful way.

Copy link

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggestion. I believe the ping send handling code makes the counter increments conditional, so it might be nice to match (and save a little time)

Copy link

@bw-solana bw-solana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mergify mergify bot merged commit 246fe45 into v2.0 Sep 30, 2024
39 checks passed
@mergify mergify bot deleted the mergify/bp/v2.0/pr-3006 branch September 30, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants