-
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 join validation #37203
Zen2: Add join validation #37203
Conversation
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.
Looks good. I left some nits.
@@ -277,6 +281,11 @@ PublishWithJoinResponse handlePublishRequest(PublishRequest publishRequest) { | |||
+ lastKnownLeader + ", rejecting"); | |||
} | |||
|
|||
if (publishRequest.getAcceptedState().term() > coordinationState.get().getLastAcceptedState().term()) { | |||
// only do join validation if we have not accepted state from this master yet | |||
onJoinValidators.stream().forEach(a -> a.accept(getLocalNode(), publishRequest.getAcceptedState())); |
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.
Apparently the .stream()
is unnecessary.
@@ -131,7 +131,7 @@ public DiscoveryModule(Settings settings, ThreadPool threadPool, TransportServic | |||
discoveryTypes.put(ZEN2_DISCOVERY_TYPE, () -> new Coordinator(NODE_NAME_SETTING.get(settings), settings, clusterSettings, | |||
transportService, namedWriteableRegistry, allocationService, masterService, | |||
() -> gatewayMetaState.getPersistedState(settings, (ClusterApplierService) clusterApplier), hostsProvider, clusterApplier, | |||
Randomness.get())); | |||
joinValidators, Randomness.get())); |
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.
We say Collections.unmodifiableCollection(joinValidators)
above. Should we also do so here?
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.
it's not necessary because it's wrapped again with addBuiltInJoinValidators
. I will remove the unmodifiableCollection
call above for uniformity.
server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java
Outdated
Show resolved
Hide resolved
|
||
if (stateForJoinValidation.nodes().isLocalNodeElectedMaster()) { | ||
// we do this in a couple of places including the cluster update thread. This one here is really just best effort | ||
// to ensure we fail as fast as possible. |
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 this true? I see that we call ensureIndexCompatibility
and ensureNodesCompatibility
in JoinTaskExecutor
, but I don't see that we call any other join validators there.
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.
copied this from ZenDiscovery. It's obviously wrong. I've moved the comment to the call of ensureMajorVersionBarrier
, to which is actually applies
Merged latest master, as FlushIT test failed because missing #37229 |
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
Adds join validation to Zen2, which prevents a node from joining a cluster when the node does not have the right ES version or does not satisfy any other of the join validation constraints.