Skip to content

Commit b4e462a

Browse files
committed
Fix place-holder in allocation decider messages (#27436)
Allocation decider messages were using the wrong place-holder, which resulted in output of the form "no allocations are allowed due to {}" when showing diagnostics information in the explain API.
1 parent 2d2715a commit b4e462a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AllocationDecider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public Decision canForceAllocatePrimary(ShardRouting shardRouting, RoutingNode n
118118
// On a NO decision, by default, we allow force allocating the primary.
119119
return allocation.decision(Decision.YES,
120120
decision.label(),
121-
"primary shard [{}] allowed to force allocate on node [{}]",
121+
"primary shard [%s] allowed to force allocate on node [%s]",
122122
shardRouting.shardId(), node.nodeId());
123123
} else {
124124
// On a THROTTLE/YES decision, we use the same decision instead of forcing allocation

core/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDecider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
116116
case ALL:
117117
return allocation.decision(Decision.YES, NAME, "all allocations are allowed");
118118
case NONE:
119-
return allocation.decision(Decision.NO, NAME, "no allocations are allowed due to {}", setting(enable, usedIndexSetting));
119+
return allocation.decision(Decision.NO, NAME, "no allocations are allowed due to %s", setting(enable, usedIndexSetting));
120120
case NEW_PRIMARIES:
121121
if (shardRouting.primary() && shardRouting.active() == false &&
122122
shardRouting.recoverySource().getType() != RecoverySource.Type.EXISTING_STORE) {
123123
return allocation.decision(Decision.YES, NAME, "new primary allocations are allowed");
124124
} else {
125-
return allocation.decision(Decision.NO, NAME, "non-new primary allocations are forbidden due to {}",
125+
return allocation.decision(Decision.NO, NAME, "non-new primary allocations are forbidden due to %s",
126126
setting(enable, usedIndexSetting));
127127
}
128128
case PRIMARIES:
129129
if (shardRouting.primary()) {
130130
return allocation.decision(Decision.YES, NAME, "primary allocations are allowed");
131131
} else {
132-
return allocation.decision(Decision.NO, NAME, "replica allocations are forbidden due to {}",
132+
return allocation.decision(Decision.NO, NAME, "replica allocations are forbidden due to %s",
133133
setting(enable, usedIndexSetting));
134134
}
135135
default:

0 commit comments

Comments
 (0)