-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add WriteLoadDecider canRemain logic #135326
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
Add WriteLoadDecider canRemain logic #135326
Conversation
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
.../java/org/elasticsearch/cluster/routing/allocation/decider/WriteLoadConstraintDeciderIT.java
Show resolved
Hide resolved
.../java/org/elasticsearch/cluster/routing/allocation/decider/WriteLoadConstraintDeciderIT.java
Show resolved
Hide resolved
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 with some minor cosmetic nits
Making utility methods for the repetitive set-up will keep the body of the test method focused on the behaviour being tested.
| (handler, request, channel, task) -> channel.sendResponse( | ||
| new NodeUsageStatsForThreadPoolsAction.NodeResponse(harness.thirdDiscoveryNode, thirdNodeUtilHotSpottingNodeStats) | ||
| ) | ||
| ); |
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.
Nit: this could be DRY'd, e.g.
mockNodeUsageStats(harness.thirdDiscoveryNode, thirdNodeUtilHotSpottingNodeStats)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.
Fair point, done! 93a133a
| harness.thirdDataNodeName | ||
| ); | ||
| channel.sendResponse(instance.new NodeResponse(harness.thirdDataNodeId, 0, List.of(), List.of())); | ||
| }); |
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.
Also this ^^^
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.
| Level.DEBUG, | ||
| "Desired balance computation for * is completed, scheduling reconciliation" | ||
| ) | ||
| ); |
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.
Also this ? ^^^
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, done 👍 9a5fe8d
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.
Actually, perhaps you meant the whole MockLog.awaitLogger statement? It looks more concise with MockLog.SeenEventExpectation modularized. I think I prefer to see the actions that the test is taking -- refreshClusterInfo and updateClusterSettings -- so I left that alone.
| (handler, request, channel, task) -> channel.sendResponse( | ||
| new NodeUsageStatsForThreadPoolsAction.NodeResponse(harness.thirdDiscoveryNode, thirdNodeNonHotSpottingNodeStats) | ||
| ) | ||
| ); |
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.
DRY ☝️
| harness.thirdDataNodeName | ||
| ); | ||
| channel.sendResponse(instance.new NodeResponse(harness.thirdDataNodeId, 0, List.of(), List.of())); | ||
| }); |
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.
☝️
| Level.DEBUG, | ||
| "Desired balance updated for *" | ||
| ) | ||
| ); |
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.
☝️
| TimeValue.timeValueMillis(queueLatencyThresholdMillis) | ||
| ) | ||
| // Essentially disable rebalancing so that testing can see Decider change outcomes. | ||
| .put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 1000f) |
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.
Nit: Could you use EnableAllocationDecider#CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING to be more explicit?
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.
Yep, that looks better 👍 592cd08
|
|
||
| if (logger.isTraceEnabled()) { | ||
| logger.trace(explanation); | ||
| } |
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.
Nit: I don't think we need to wrap this in the conditional, log4j will do that immediately inside logger.trace(...). Explicit checks like this are only useful to avoid expensive pre-calculation or fetching that may be required for the log message. Here we're just passing in a string that already exists (i.e. zero cost).
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.
Good point, copy-paste for the fail 🙂 Fixed 👍 2fe4115
…le rebalancing entirely
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.
Updated. Good idea to modularize the transport action overrides, it looks better now.
| (handler, request, channel, task) -> channel.sendResponse( | ||
| new NodeUsageStatsForThreadPoolsAction.NodeResponse(harness.thirdDiscoveryNode, thirdNodeUtilHotSpottingNodeStats) | ||
| ) | ||
| ); |
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.
Fair point, done! 93a133a
| harness.thirdDataNodeName | ||
| ); | ||
| channel.sendResponse(instance.new NodeResponse(harness.thirdDataNodeId, 0, List.of(), List.of())); | ||
| }); |
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.
| Level.DEBUG, | ||
| "Desired balance computation for * is completed, scheduling reconciliation" | ||
| ) | ||
| ); |
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, done 👍 9a5fe8d
| Level.DEBUG, | ||
| "Desired balance computation for * is completed, scheduling reconciliation" | ||
| ) | ||
| ); |
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.
Actually, perhaps you meant the whole MockLog.awaitLogger statement? It looks more concise with MockLog.SeenEventExpectation modularized. I think I prefer to see the actions that the test is taking -- refreshClusterInfo and updateClusterSettings -- so I left that alone.
| TimeValue.timeValueMillis(queueLatencyThresholdMillis) | ||
| ) | ||
| // Essentially disable rebalancing so that testing can see Decider change outcomes. | ||
| .put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 1000f) |
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.
Yep, that looks better 👍 592cd08
|
|
||
| if (logger.isTraceEnabled()) { | ||
| logger.trace(explanation); | ||
| } |
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.
Good point, copy-paste for the fail 🙂 Fixed 👍 2fe4115
Closes ES-12633