-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add structure to collect and coalesce vote packets #27558
Add structure to collect and coalesce vote packets #27558
Conversation
bd17a83
to
06d4f46
Compare
f938608
to
2f9f132
Compare
self.latest_votes_per_pubkey | ||
.read() | ||
.unwrap() | ||
.get(&pubkey) | ||
.cloned() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double checking, there's no danger of this Arc<RwLock>
for this same pubkey being replaced with a new one right?
i.e. something like
Read A
A
gets removed from the hashmap
A'
gets re-inserted in to the hashmap
Some other thread gets A'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's possible, there's no operations to remove an entry, only clear the packet it contains. Also we only add new pubkeys if they don't currently exist in the map
|
||
#[derive(Debug, Default)] | ||
pub struct LatestUnprocessedVotes { | ||
latest_votes_per_pubkey: RwLock<HashMap<Pubkey, Arc<RwLock<LatestValidatorVotePacket>>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a size limit on the number of pubkeys this can hold before we start dropping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently, but I can add a capacity - which pubkeys would we decide to drop though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will address it as part of #27409
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kk just gotta make sure if we add removal of pubkeys this doesn't become an issue: #27558 (comment)
Will be used in banking stage to throw out extraneous vote packets before processing
2f9f132
to
6502f45
Compare
Will be used in banking stage to throw out extraneous vote packets
before processing
Problem
Picks up from #26722 .
Summary of Changes
Creates a thread safe structure to store vote packets - only latest by slot # for each validator.
Fixes #