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

removes epoch_authorized_voters from VoteTracker #22192

Merged

Conversation

behzadnouri
Copy link
Contributor

Problem

#22169
verifies authorized-voter early on in vote-listener; so VoteTracker no
longer needs to maintain and check for epoch authorized voters.

Summary of Changes

removed epoch_authorized_voters from VoteTracker

t-nelson
t-nelson previously approved these changes Dec 30, 2021
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

nice! we like the red dashes 🙂

Just one readability nit that you're free to take or leave

core/src/cluster_info_vote_listener.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 30, 2021

Codecov Report

Merging #22192 (1eeaff5) into master (0b1b36f) will decrease coverage by 0.0%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #22192     +/-   ##
=========================================
- Coverage    81.0%    81.0%   -0.1%     
=========================================
  Files         523      523             
  Lines      146497   146337    -160     
=========================================
- Hits       118739   118608    -131     
+ Misses      27758    27729     -29     

@behzadnouri behzadnouri force-pushed the rm-filter-gossip-votes-squashed branch from 44de4ff to 8bd5717 Compare December 31, 2021 16:17
@mergify mergify bot dismissed t-nelson’s stale review December 31, 2021 16:17

Pull request has been modified.

t-nelson
t-nelson previously approved these changes Dec 31, 2021

slot_tracker.unwrap()
fn get_or_insert_slot_tracker(&self, slot: Slot) -> Arc<RwLock<SlotVoteTracker>> {
let mut slot_vote_trackers = self.slot_vote_trackers.write().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to keep the original locking structure to avoid any perf differences (read -> write only in case the slot doesn't exist).

This is because in the original code each slot should only take the top level slot_vote_trackers lock once on creation, whereas in this new code, the top level write lock will be taken for every validator, for every slot. This may affect replay's propagation check which is also reading this lock for specific slots

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was changed because the original code has a race condition.
Between the time the read-lock is released and the write-lock is obtained, the object can be modified by a different thread. So always need to check the condition again under the write-lock.

I added an additional look-up under a read-lock, but note that this new code still avoids the race condition above.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah yeah this code was written under the assumption the vote listener thread would be the only one modifying this structure, kind of like the cluster_slots_service as well. This does look much cleaner though, thanks!

solana-labs#22169
verifies authorized-voter early on in vote-listener pipeline; and so
VoteTracker no longer needs to maintain and check for epoch authorized
voters.
@behzadnouri behzadnouri force-pushed the rm-filter-gossip-votes-squashed branch from 8bd5717 to 1eeaff5 Compare December 31, 2021 23:47
@mergify mergify bot dismissed t-nelson’s stale review December 31, 2021 23:48

Pull request has been modified.

@behzadnouri behzadnouri merged commit 69d71f8 into solana-labs:master Jan 3, 2022
@behzadnouri behzadnouri deleted the rm-filter-gossip-votes-squashed branch January 3, 2022 21:07
mergify bot pushed a commit that referenced this pull request Jan 3, 2022
#22169
verifies authorized-voter early on in vote-listener pipeline; and so
VoteTracker no longer needs to maintain and check for epoch authorized
voters.

(cherry picked from commit 69d71f8)

# Conflicts:
#	core/src/cluster_info_vote_listener.rs
mergify bot pushed a commit that referenced this pull request Jan 3, 2022
#22169
verifies authorized-voter early on in vote-listener pipeline; and so
VoteTracker no longer needs to maintain and check for epoch authorized
voters.

(cherry picked from commit 69d71f8)

# Conflicts:
#	core/src/cluster_info_vote_listener.rs
mergify bot added a commit that referenced this pull request Jan 4, 2022
…22248)

* removes epoch_authorized_voters from VoteTracker (#22192)

#22169
verifies authorized-voter early on in vote-listener pipeline; and so
VoteTracker no longer needs to maintain and check for epoch authorized
voters.

(cherry picked from commit 69d71f8)

# Conflicts:
#	core/src/cluster_info_vote_listener.rs

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
mergify bot added a commit that referenced this pull request Jan 4, 2022
…22250)

* removes epoch_authorized_voters from VoteTracker (#22192)

#22169
verifies authorized-voter early on in vote-listener pipeline; and so
VoteTracker no longer needs to maintain and check for epoch authorized
voters.

(cherry picked from commit 69d71f8)

# Conflicts:
#	core/src/cluster_info_vote_listener.rs

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
@brooksprumo brooksprumo mentioned this pull request Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants