Skip to content
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

[Test] Ensure latest cluster info is used in tests #116908

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Nov 18, 2024

DesiredBalanceMetrics#updateMetrics is called on reroute which is frequent but not guaranteed. It can also takes some time to complete. This PR adds an explicit reroute to ensure the latest cluster info is picked up.

Resolves: #116870

DesiredBalanceMetrics#updateMetrics is called on reroute which is
frequent but not guaranteed. It can also takes some time to complete.
This PR adds an explicit reroute to ensure the latest cluster info is
picked up.

Resolves: elastic#116870
@ywangd ywangd added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v9.0.0 labels Nov 18, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Nov 18, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@@ -68,6 +69,7 @@ public void testDesiredBalanceMetrics() {
final var infoService = (InternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance(ClusterInfoService.class);
ClusterInfoServiceUtils.setUpdateFrequency(infoService, TimeValue.timeValueMillis(200));
assertNotNull("info should not be null", ClusterInfoServiceUtils.refresh(infoService));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that the asyncRefresh for clusterInfo can also pause which makes the refresh call here to get back a stale result since the newRefresh is short-circuited if there is already one running. If that does happen, it might also lead to test failure. But in practice, I was not able to make it happen, probably due to the short update interval of 200ms. So I am leaving it as is.

Copy link
Member

@pxsalehi pxsalehi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let me know if this fails again, I can simplify/improve the test.

@ywangd ywangd merged commit c32b300 into elastic:main Nov 18, 2024
16 checks passed
salvatore-campagna pushed a commit to salvatore-campagna/elasticsearch that referenced this pull request Nov 18, 2024
DesiredBalanceMetrics#updateMetrics is called on reroute which is
frequent but not guaranteed. It can also take some time to complete.
This PR adds an explicit reroute to ensure the latest cluster info is
picked up.

Resolves: elastic#116870
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
DesiredBalanceMetrics#updateMetrics is called on reroute which is
frequent but not guaranteed. It can also take some time to complete.
This PR adds an explicit reroute to ensure the latest cluster info is
picked up.

Resolves: elastic#116870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) Team:Distributed Coordination Meta label for Distributed Coordination team >test Issues or PRs that are addressing/adding tests v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] DesiredBalanceReconcilerMetricsIT testDesiredBalanceMetrics failing
4 participants