Skip to content

Format message only when debug is enabled #96437

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
if (replacementOngoing(allocation) == false) {
return YES__NO_REPLACEMENTS;
} else if (replacementFromSourceToTarget(allocation, shardRouting.currentNodeId(), node.node().getName())) {
return Decision.single(
Decision.Type.YES,
return allocation.decision(
Decision.YES,
NAME,
"node [%s] is replacing node [%s], and may receive shards from it",
shardRouting.currentNodeId(),
Expand All @@ -48,16 +48,16 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
return YES__RECONCILING;
}

return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is being replaced, and its shards may only be allocated to the replacement target [%s]",
shardRouting.currentNodeId(),
getReplacementName(allocation, shardRouting.currentNodeId())
);
} else if (isReplacementSource(allocation, node.nodeId())) {
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is being replaced by [%s], so no data may be allocated to it",
node.nodeId(),
Expand All @@ -73,8 +73,8 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
}

final SingleNodeShutdownMetadata shutdown = allocation.replacementTargetShutdowns().get(node.node().getName());
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is replacing the vacating node [%s], only data currently allocated to the source node "
+ "may be allocated to it until the replacement is complete",
Expand All @@ -92,8 +92,8 @@ public Decision canRemain(IndexMetadata indexMetadata, ShardRouting shardRouting
if (replacementOngoing(allocation) == false) {
return YES__NO_REPLACEMENTS;
} else if (isReplacementSource(allocation, node.nodeId())) {
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is being replaced by node [%s], so no data may remain on it",
node.nodeId(),
Expand All @@ -110,17 +110,17 @@ public Decision shouldAutoExpandToNode(IndexMetadata indexMetadata, DiscoveryNod
return YES__NO_REPLACEMENTS;
} else if (isReplacementTargetName(allocation, node.getName())) {
final SingleNodeShutdownMetadata shutdown = allocation.replacementTargetShutdowns().get(node.getName());
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is a node replacement target for node [%s], "
+ "shards cannot auto expand to be on it until the replacement is complete",
node.getId(),
shutdown == null ? null : shutdown.getNodeId()
);
} else if (isReplacementSource(allocation, node.getId())) {
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"node [%s] is being replaced by [%s], shards cannot auto expand to be on it",
node.getId(),
Expand All @@ -134,16 +134,16 @@ public Decision shouldAutoExpandToNode(IndexMetadata indexMetadata, DiscoveryNod
@Override
public Decision canForceAllocateDuringReplace(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
if (replacementFromSourceToTarget(allocation, shardRouting.currentNodeId(), node.node().getName())) {
return Decision.single(
Decision.Type.YES,
return allocation.decision(
Decision.YES,
NAME,
"node [%s] is being replaced by node [%s], and can be force vacated to the target",
shardRouting.currentNodeId(),
node.nodeId()
);
} else {
return Decision.single(
Decision.Type.NO,
return allocation.decision(
Decision.NO,
NAME,
"shard is not on the source of a node replacement relocated to the replacement target"
);
Expand All @@ -153,8 +153,8 @@ public Decision canForceAllocateDuringReplace(ShardRouting shardRouting, Routing
@Override
public Decision canAllocateReplicaWhenThereIsRetentionLease(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
if (isReplacementTargetName(allocation, node.node().getName())) {
return Decision.single(
Decision.Type.YES,
return allocation.decision(
Decision.YES,
NAME,
"node [%s] is a node replacement target and can have a previously allocated replica re-allocated to it",
node.nodeId()
Expand Down