-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Fix autoexpand during node replace #96281
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 autoexpand during node replace #96281
Conversation
Prior to this change NodeReplacementAllocationDecider was unconditionally skipping both replacement source and target nodes when calculation auto-expand replicas. This is fixed by autoexpanding to the replacement node if source node already had shards of the index
Pinging @elastic/es-distributed (Team:Distributed) |
Hi @idegtiarenko, I've created a changelog YAML for you. |
shardRouting.currentNodeId(), | ||
node.nodeId() | ||
node.nodeId(), | ||
shardRouting.currentNodeId() |
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.
The order was flipped
EmptyClusterInfoService.INSTANCE, | ||
EmptySnapshotsInfoService.INSTANCE, | ||
TestShardRoutingRoleStrategies.DEFAULT_ROLE_ONLY | ||
); |
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.
This was unused test setup, removed in a separate commit to make it easier to review
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 working on this. I left some comments to address.
...a/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
Outdated
Show resolved
Hide resolved
) | ||
.build(); | ||
allocation = new RoutingAllocation(allocationDeciders, state, null, null, 0); | ||
assertThatAutoExpandReplicasDidNotContract(indexMetadata, allocation); |
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.
Can we add verification of the decider also after the source node is shutdown, but with the shutdown record still in place?
); | ||
|
||
// when replacing NODE_A with NODE_B | ||
state = ClusterState.builder(state) | ||
.nodes(DiscoveryNodes.builder().add(NODE_A).add(NODE_B).add(NODE_C).build()) |
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.
I think we need to test the scenario where we add the shutdown indication first and then add the node later (verifying that no contraction happens in between).
I specifically think that will fail due to NodeShutdownAllocationDecider
saying NO
to the source node - and there is no target node yet.
# Conflicts: # server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDecider.java # server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDeciderTests.java # server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDeciderTests.java
# Conflicts: # server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
@elasticsearchmachine please run elasticsearch-ci/bwc |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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 additional work on this. I left a number of smaller comments and test comments.
...a/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java
Outdated
Show resolved
Hide resolved
...org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDeciderTests.java
Outdated
Show resolved
Hide resolved
...org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDeciderTests.java
Show resolved
Hide resolved
...down/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownShardsIT.java
Outdated
Show resolved
Hide resolved
...down/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownShardsIT.java
Outdated
Show resolved
Hide resolved
...down/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownShardsIT.java
Outdated
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.
A couple of comments from last review seems unaddressed (if not, please point me to the verifications).
.../elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDeciderTests.java
Outdated
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.
Prior to this change NodeReplacementAllocationDecider was unconditionally skipping both replacement source and target nodes when calculation auto-expand replicas. This is fixed by autoexpanding to the replacement node if source node already had shards of the index Backport of PR elastic#96281 amended for 7.17.x Closes elastic#89527
Prior to this change NodeReplacementAllocationDecider was unconditionally skipping both replacement source and target nodes when calculation auto-expand replicas. This is fixed by autoexpanding to the replacement node if source node already had shards of the index Backport of PR #96281 amended for 7.17.x Closes #89527 Co-authored-by: Ievgen Degtiarenko <[email protected]>
Added the |
Prior to this change NodeReplacementAllocationDecider was unconditionally
skipping both replacement source and target nodes when calculation auto-expand
replicas. This is fixed by autoexpanding to the replacement node if source node
already had shards of the index.
Closes: #89527