Skip to content

Commit c986867

Browse files
authored
WriteLoadConstraintDecider: Don't require shard write load to return canRemain=NOT_PREFERRED (#137416)
1 parent c3d7241 commit c986867

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/WriteLoadConstraintDecider.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ public Decision canRemain(IndexMetadata indexMetadata, ShardRouting shardRouting
129129
return Decision.single(Decision.Type.YES, NAME, "canRemain() is not enabled");
130130
}
131131

132-
// Check whether the shard being relocated has any write load estimate. If it does not, then this decider has no opinion.
133-
var allShardWriteLoads = allocation.clusterInfo().getShardWriteLoads();
134-
var shardWriteLoad = allShardWriteLoads.get(shardRouting.shardId());
135-
if (shardWriteLoad == null || shardWriteLoad == 0) {
136-
return Decision.single(Decision.Type.YES, NAME, "Shard has no estimated write load. Decider takes no action.");
137-
}
138-
139132
var allNodeUsageStats = allocation.clusterInfo().getNodeUsageStatsForThreadPools();
140133
var nodeUsageStatsForThreadPools = allNodeUsageStats.get(node.nodeId());
141134
if (nodeUsageStatsForThreadPools == null) {

server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/WriteLoadConstraintDeciderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public void testWriteLoadDeciderCanRemain() {
234234
).type()
235235
);
236236
assertEquals(
237-
"A shard without write load should remain on a node with queuing above the threshold",
238-
Decision.Type.YES,
237+
"A shard with no write load can still return NOT_PREFERRED",
238+
Decision.Type.NOT_PREFERRED,
239239
writeLoadDecider.canRemain(
240240
testHarness.clusterState.metadata().getProject().index(indexName),
241241
testHarness.shardRoutingNoWriteLoad,

0 commit comments

Comments
 (0)