@@ -101,7 +101,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
101
101
if (migrationDirection .equals (Direction .NONE )) {
102
102
// remote backed indices on docrep nodes and non remote backed indices on remote nodes are not allowed
103
103
boolean isNoDecision = remoteSettingsBackedIndex ^ targetNode .isRemoteStoreNode ();
104
- String reason = String . format ( Locale . ROOT , " for %sremote store backed index" , remoteSettingsBackedIndex ? "" : "non " );
104
+ String reason = " for " + ( remoteSettingsBackedIndex ? "" : "non " ) + "remote store backed index" ;
105
105
return allocation .decision (
106
106
isNoDecision ? Decision .NO : Decision .YES ,
107
107
NAME ,
@@ -114,11 +114,9 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
114
114
// check for remote store backed indices
115
115
if (remoteSettingsBackedIndex && targetNode .isRemoteStoreNode () == false ) {
116
116
// allocations and relocations must be to a remote node
117
- String reason = String .format (
118
- Locale .ROOT ,
119
- " because a remote store backed index's shard copy can only be %s to a remote node" ,
120
- ((shardRouting .assignedToNode () == false ) ? "allocated" : "relocated" )
121
- );
117
+ String reason = new StringBuilder (" because a remote store backed index's shard copy can only be " )
118
+ .append ((shardRouting .assignedToNode () == false ) ? "allocated" : "relocated" )
119
+ .append (" to a remote node" ).toString ();
122
120
return allocation .decision (Decision .NO , NAME , getDecisionDetails (false , shardRouting , targetNode , reason ));
123
121
}
124
122
@@ -168,16 +166,10 @@ private Decision replicaShardDecision(ShardRouting replicaShardRouting, Discover
168
166
169
167
// get detailed reason for the decision
170
168
private String getDecisionDetails (boolean isYes , ShardRouting shardRouting , DiscoveryNode targetNode , String reason ) {
171
- return String .format (
172
- Locale .ROOT ,
173
- "[%s migration_direction]: %s shard copy %s be %s to a %s node%s" ,
174
- migrationDirection .direction ,
175
- (shardRouting .primary () ? "primary" : "replica" ),
176
- (isYes ? "can" : "can not" ),
177
- ((shardRouting .assignedToNode () == false ) ? "allocated" : "relocated" ),
178
- (targetNode .isRemoteStoreNode () ? "remote" : "non-remote" ),
179
- reason
180
- );
169
+ return new StringBuilder ("[" ).append (migrationDirection .direction ).append (" migration_direction]: " )
170
+ .append (shardRouting .primary () ? "primary" : "replica" ).append (" shard copy " ).append (isYes ? "can" : "can not" )
171
+ .append (" be " ).append ((shardRouting .assignedToNode () == false ) ? "allocated" : "relocated" ).append (" to a " )
172
+ .append (targetNode .isRemoteStoreNode () ? "remote" : "non-remote" ).append (" node " ).append (reason ).toString ();
181
173
}
182
174
183
175
}
0 commit comments