-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Switch more tests to zen2 #36367
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
Merged
Merged
Switch more tests to zen2 #36367
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a2a0632
Switch more tests to zen2
3395e2e
Remove extra logging
edfa48a
SnapshotDisruptionIT
830def1
Revert testDanglingIndices, except TODO
6e5bbd4
Exclude node from voting configuration when restarting it
4d9d141
RemoveCorruptedShardDataCommandIT cluster -> suite internal cluster
a500d20
&& -> ||
6ad7ee4
Merge branch 'master' into zen2_more_tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1636,35 +1636,7 @@ private synchronized void stopNodesAndClient(NodeAndClient nodeAndClient) throws | |
| } | ||
|
|
||
| private synchronized void stopNodesAndClients(Collection<NodeAndClient> nodeAndClients) throws IOException { | ||
| final Set<String> excludedNodeIds = new HashSet<>(); | ||
|
|
||
| if (autoManageMinMasterNodes && nodeAndClients.size() > 0) { | ||
|
|
||
| final long currentMasters = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); | ||
| final long stoppingMasters = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); | ||
|
|
||
| assert stoppingMasters <= currentMasters : currentMasters + " < " + stoppingMasters; | ||
| if (stoppingMasters != currentMasters && stoppingMasters > 0) { | ||
| // If stopping few enough master-nodes that there's still a majority left, there is no need to withdraw their votes first. | ||
| // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have | ||
| // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. | ||
| // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed | ||
| nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).map(NodeAndClient::getName).forEach(excludedNodeIds::add); | ||
| assert excludedNodeIds.size() == stoppingMasters; | ||
|
|
||
| logger.info("adding voting config exclusions {} prior to shutdown", excludedNodeIds); | ||
| try { | ||
| client().execute(AddVotingConfigExclusionsAction.INSTANCE, | ||
| new AddVotingConfigExclusionsRequest(excludedNodeIds.toArray(new String[0]))).get(); | ||
| } catch (InterruptedException | ExecutionException e) { | ||
| throw new AssertionError("unexpected", e); | ||
| } | ||
| } | ||
|
|
||
| if (stoppingMasters > 0) { | ||
| updateMinMasterNodes(getMasterNodesCount() - Math.toIntExact(stoppingMasters)); | ||
| } | ||
| } | ||
| final Set<String> excludedNodeIds = excludeMasters(nodeAndClients); | ||
|
|
||
| for (NodeAndClient nodeAndClient: nodeAndClients) { | ||
| removeDisruptionSchemeFromNode(nodeAndClient); | ||
|
|
@@ -1673,14 +1645,7 @@ private synchronized void stopNodesAndClients(Collection<NodeAndClient> nodeAndC | |
| nodeAndClient.close(); | ||
| } | ||
|
|
||
| if (excludedNodeIds.isEmpty() == false) { | ||
| logger.info("removing voting config exclusions for {} after shutdown", excludedNodeIds); | ||
| try { | ||
| client().execute(ClearVotingConfigExclusionsAction.INSTANCE, new ClearVotingConfigExclusionsRequest()).get(); | ||
| } catch (InterruptedException | ExecutionException e) { | ||
| throw new AssertionError("unexpected", e); | ||
| } | ||
| } | ||
| removeExclusions(excludedNodeIds); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -1746,31 +1711,78 @@ public synchronized void rollingRestart(RestartCallback callback) throws Excepti | |
|
|
||
| private void restartNode(NodeAndClient nodeAndClient, RestartCallback callback) throws Exception { | ||
| logger.info("Restarting node [{}] ", nodeAndClient.name); | ||
|
|
||
| if (activeDisruptionScheme != null) { | ||
| activeDisruptionScheme.removeFromNode(nodeAndClient.name, this); | ||
| } | ||
| final int masterNodesCount = getMasterNodesCount(); | ||
| // special case to allow stopping one node in a two node cluster and keep it functional | ||
| final boolean updateMinMaster = nodeAndClient.isMasterEligible() && masterNodesCount == 2 && autoManageMinMasterNodes; | ||
| if (updateMinMaster) { | ||
| updateMinMasterNodes(masterNodesCount - 1); | ||
| } | ||
|
|
||
| Set<String> excludedNodeIds = excludeMasters(Collections.singleton(nodeAndClient)); | ||
|
|
||
| final Settings newSettings = nodeAndClient.closeForRestart(callback, | ||
| autoManageMinMasterNodes ? getMinMasterNodes(masterNodesCount) : -1); | ||
| autoManageMinMasterNodes ? getMinMasterNodes(getMasterNodesCount()) : -1); | ||
|
|
||
| removeExclusions(excludedNodeIds); | ||
|
|
||
| nodeAndClient.recreateNode(newSettings, () -> rebuildUnicastHostFiles(emptyList())); | ||
| nodeAndClient.startNode(); | ||
| if (activeDisruptionScheme != null) { | ||
| activeDisruptionScheme.applyToNode(nodeAndClient.name, this); | ||
| } | ||
| if (callback.validateClusterForming() || updateMinMaster) { | ||
|
|
||
| if (callback.validateClusterForming() && excludedNodeIds.isEmpty() == false) { | ||
|
||
| // we have to validate cluster size if updateMinMaster == true, because we need the | ||
| // second node to join in order to increment min_master_nodes back to 2. | ||
| // we also have to do via the node that was just restarted as it may be that the master didn't yet process | ||
| // the fact it left | ||
| validateClusterFormed(nodeAndClient.name); | ||
| } | ||
| if (updateMinMaster) { | ||
| updateMinMasterNodes(masterNodesCount); | ||
|
|
||
| if (excludedNodeIds.isEmpty() == false) { | ||
| updateMinMasterNodes(getMasterNodesCount()); | ||
| } | ||
| } | ||
|
|
||
| private Set<String> excludeMasters(Collection<NodeAndClient> nodeAndClients) { | ||
| final Set<String> excludedNodeIds = new HashSet<>(); | ||
| if (autoManageMinMasterNodes && nodeAndClients.size() > 0) { | ||
|
|
||
| final long currentMasters = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); | ||
| final long stoppingMasters = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); | ||
|
|
||
| assert stoppingMasters <= currentMasters : currentMasters + " < " + stoppingMasters; | ||
| if (stoppingMasters != currentMasters && stoppingMasters > 0) { | ||
| // If stopping few enough master-nodes that there's still a majority left, there is no need to withdraw their votes first. | ||
| // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have | ||
| // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. | ||
| // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed | ||
| nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).map(NodeAndClient::getName).forEach(excludedNodeIds::add); | ||
| assert excludedNodeIds.size() == stoppingMasters; | ||
|
|
||
| logger.info("adding voting config exclusions {} prior to restart/shutdown", excludedNodeIds); | ||
| try { | ||
| client().execute(AddVotingConfigExclusionsAction.INSTANCE, | ||
| new AddVotingConfigExclusionsRequest(excludedNodeIds.toArray(new String[0]))).get(); | ||
| } catch (InterruptedException | ExecutionException e) { | ||
| throw new AssertionError("unexpected", e); | ||
| } | ||
| } | ||
|
|
||
| if (stoppingMasters > 0) { | ||
| updateMinMasterNodes(getMasterNodesCount() - Math.toIntExact(stoppingMasters)); | ||
| } | ||
| } | ||
| return excludedNodeIds; | ||
| } | ||
|
|
||
| private void removeExclusions(Set<String> excludedNodeIds) { | ||
| if (excludedNodeIds.isEmpty() == false) { | ||
| logger.info("removing voting config exclusions for {} after restart/shutdown", excludedNodeIds); | ||
| try { | ||
| Client client = getRandomNodeAndClient(node -> excludedNodeIds.contains(node.name) == false).client(random); | ||
| client.execute(ClearVotingConfigExclusionsAction.INSTANCE, new ClearVotingConfigExclusionsRequest()).get(); | ||
| } catch (InterruptedException | ExecutionException e) { | ||
| throw new AssertionError("unexpected", e); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1828,7 +1840,6 @@ public synchronized void fullRestart(RestartCallback callback) throws Exception | |
| } | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Returns the name of the current master node in the cluster. | ||
| */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
thanks for the analysis on this one. It still has Zen2 disabled though? Can you just add the TODO comment, but leave the test unchanged until we have a proper fix?
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.
830def1