- Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix NPE in Desired Balance API #97775
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
Fix NPE in Desired Balance API #97775
Conversation
If a shard has no desired assignment then we cannot send the desired balance over the wire or render it as JSON because the `ShardAssignmentView` is `null`. This commit replaces the spurious `null` with an empty object, and cleans up the tests a little to remove some unnecessary mocking.
| Pinging @elastic/es-distributed (Team:Distributed) |
| Hi @DaveCTurner, I've created a changelog YAML for you. |
| assertEquals(shardAssignment.get().unassigned(), desiredShard.desired().unassigned()); | ||
| assertEquals(shardAssignment.get().ignored(), desiredShard.desired().ignored()); | ||
| final var shardAssignment = shardAssignments.get(indexShardRoutingTable.shardId()); | ||
| if (shardAssignment == null) { |
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 test generating null assignments?
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.
Yes it only assigns some random subset of the shards.
If a shard has no desired assignment then we cannot send the desired balance over the wire or render it as JSON because the `ShardAssignmentView` is `null`. This commit replaces the spurious `null` with an empty object, and cleans up the tests a little to remove some unnecessary mocking.
| I'm confused, this is apparently merged at 1ef7d3f but this PR is still open. |
💔 Backport failedYou can use sqren/backport to manually backport by running |
If a shard has no desired assignment then we cannot send the desired balance over the wire or render it as JSON because the `ShardAssignmentView` is `null`. This commit replaces the spurious `null` with an empty object, and cleans up the tests a little to remove some unnecessary mocking.
If a shard has no desired assignment then we cannot send the desired balance over the wire or render it as JSON because the `ShardAssignmentView` is `null`. This commit replaces the spurious `null` with an empty object, and cleans up the tests a little to remove some unnecessary mocking.
If a shard has no desired assignment then we cannot send the desired
balance over the wire or render it as JSON because the
ShardAssignmentViewisnull. This commit replaces the spuriousnullwith an empty object, and cleans up the tests a little to removesome unnecessary mocking.