-
Notifications
You must be signed in to change notification settings - Fork 209
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
banking_stage: track VoteStorage size instead of costly iterator #743
Conversation
66d468c
to
48f4d56
Compare
48f4d56
to
a3f7340
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #743 +/- ##
========================================
Coverage 81.9% 81.9%
========================================
Files 851 851
Lines 230937 231012 +75
========================================
+ Hits 189217 189333 +116
+ Misses 41720 41679 -41 |
we want to backport this to 1.17 / 1.18? |
Backports to the stable branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. |
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
* banking_stage: track VoteStorage size instead of costly iterator * missed one --------- Co-authored-by: steviez <steven@anza.xyz> (cherry picked from commit 4fc6b0b)
* banking_stage: track VoteStorage size instead of costly iterator * missed one --------- Co-authored-by: steviez <steven@anza.xyz> (cherry picked from commit 4fc6b0b)
Probably yes on the BP's. That being said, the last update I pushed was found because we had an integer overflow in a metrics function. I think the code is probably good as is but that does make me a little nervous |
This is a very leaky design. For example there is already So the caller can do: latest_unprocessed_votes.get_entry(pubkey).unwrap().write().unwrap().take_vote() which will break this bookkeeping. The old I would pretty much rather the old (slow but correct) code unless there is a better safer design. |
|
I already read the slack thread and I don't count that as evidence that this will impact performance in any significant form.
It doesn't matter. The code changes and that is how the bugs creep in. That is what "leaky" design mean. |
A bit unfortunate that it was caught in the localnet metrics test first, we do have a lot of tests that exercise this pathway that took longer to run but eventually spotted the issue https://buildkite.com/anza/agave/builds/2374#_.
This is a valid point and part of the hesitation in implementing this approach initially (see solana-labs#26722 (comment)).
An alternative we could consider is to modify struct VotePacket {
vote_source: VoteSource,
vote: Option<Arc<ImmutableDeserializedPacket>>,
slot: Slot,
timestamp: Option<UnixTimestamp>
}
struct LatestValidatorVotePacket {
vote_packet: RwLock<VotePacket>,
forwarded: AtomicBool,
is_vote_taken: AtomicBool,
}
pub struct LatestUnprocessedVotes {
latest_votes_per_pubkey: RwLock<HashMap<Pubkey, Arc<LatestValidatorVotePacket>>>
}
|
I agree with this. I haven't reviewed the PR yet but we got here because of a footgun, so we shouldn't be introducing more footguns, as unlikely as they are to be triggered. |
@alessandrod please see #681. This should make the gossip thread spin less, by making it always wait. Haven't had a chance to pick that up on a node yet, if you wanna pick the commit in mean-time could help us both 😄 |
LatestUnprocessedVotes
uses a costly lock grabbing iterator to compute length, which is used in various parts of the banking stage.Instead track this separately in an atomic