-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[Zen2] Add PeerFinder#onFoundPeersUpdated #32939
[Zen2] Add PeerFinder#onFoundPeersUpdated #32939
Conversation
Today the PeerFinder silently updates the set of found peers as new peers are discovered and old ones are disconnected, and elections are scheduled independently of these changes. In fact, it would be better if the election scheduler were only activated on discovery of a quorum of peers. This commit introduces the `onFoundPeersUpdated` method that allows this flow.
Pinging @elastic/es-distributed |
@elasticmachine retest this please |
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.
LGTM
for (final Peer peer : peersByAddress.values()) { | ||
peer.handleWakeUp(); | ||
peersRemoved = peer.handleWakeUp() || peersRemoved; |
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.
another way to write this is to use |=
(bit-wise or), see https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2
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.
Fun with non-strict ||
vs strict |
. I'd prefer to leave as-is but will add a comment.
Today the PeerFinder silently updates the set of found peers as new peers are
discovered and old ones are disconnected, and elections are scheduled
independently of these changes. In fact, it would be better if the election
scheduler were only activated on discovery of a quorum of peers. This commit
introduces the
onFoundPeersUpdated
method that allows this flow.