-
Notifications
You must be signed in to change notification settings - Fork 408
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.2: stop unstaked nodes from pushing EpochSlots into the cluster (backport of #5141) #5286
Conversation
* stop unstaked nodes from pushing EpochSlots into the cluster * reload own stake on every epoch in case I become staked * use epoch specs to reduce contention for bank forks --------- Co-authored-by: Alex Pyattaev <[email protected]> Big thanks to Behzad for code suggestions. (cherry picked from commit 145d562)
According to @kobi-lizard epoch slots bandwidth cost over 1M$ daily on MNB. |
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 sure why these nits weren't caught in master review. don't change them here. prefer to keep bp as close to 1:1 with master as feasible
break; | ||
} | ||
let mut epoch_specs = EpochSpecs::from(bank_forks.clone()); | ||
while !exit.load(Ordering::Relaxed) { |
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.
in the future, please avoid superfluous refactors like this for changes that are intended for backport. they can go into master as a followup
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.
Sure thing!
.current_epoch_staked_nodes() | ||
.get(&node_id) | ||
.cloned() | ||
.unwrap_or_default(); |
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.
avoid smearing over potential unexpected error scenarios with dubious generics (Default
is a bug). this would have been more obvious as
let maybe_my_stake = epoch_specs
.current_epoch_staked_nodes()
.get(&node_id)
.cloned();
match maybe_my_stake {
Some(my_stake) if my_stake > 0 => {
...process
}
() => {
...drain
}
}
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.
Arguably, unwrap_or(0)
would work even better here. Agree that default can do surprising things. Should we add recommendations to avoid using default() where reasonable?
@@ -100,12 +98,25 @@ impl ClusterSlotsService { | |||
lowest_slot_elapsed.stop(); | |||
let mut process_cluster_slots_updates_elapsed = | |||
Measure::start("process_cluster_slots_updates_elapsed"); | |||
|
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.
avoid superfluous cosmetics
@alessandrod are you willing to sme this one? |
Problem
Summary of Changes
Fixes #
Partially #5034
This is an automatic backport of pull request #5141 done by [Mergify](https://mergify.com).