You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <ievgen.degtiarenko@elastic.co>
Copy file name to clipboardexpand all lines: server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/NodeReplacementAllocationDecider.java
+59-17
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,11 @@
18
18
importjava.util.Map;
19
19
importjava.util.Optional;
20
20
21
+
/**
22
+
* An allocation decider that ensures that all the shards allocated to the node scheduled for removal are relocated to the replacement node.
23
+
* It also ensures that auto-expands replicas are expanded to only the replacement source or target (not both at the same time)
24
+
* and only of the shards that were already present on the source node.
Copy file name to clipboardexpand all lines: server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/NodeShutdownAllocationDecider.java
+10
Original file line number
Diff line number
Diff line change
@@ -100,6 +100,16 @@ public Decision shouldAutoExpandToNode(IndexMetadata indexMetadata, DiscoveryNod
100
100
node.getId()
101
101
);
102
102
caseREPLACE:
103
+
if (allocation.nodes().hasByName(thisNodeShutdownMetadata.getTargetNodeName()) == false) {
104
+
returnallocation.decision(
105
+
Decision.YES,
106
+
NAME,
107
+
"node [%s] is preparing to be removed from the cluster, but replacement is not yet present",
108
+
node.getId()
109
+
);
110
+
} else {
111
+
returnallocation.decision(Decision.NO, NAME, "node [%s] is preparing for removal from the cluster", node.getId());
112
+
}
103
113
caseREMOVE:
104
114
returnallocation.decision(Decision.NO, NAME, "node [%s] is preparing for removal from the cluster", node.getId());
0 commit comments