Skip to content

Commit 2ae0fa2

Browse files
jasontedordavidkyle
authored andcommitted
Fix duplicate phrase in shrink/split error message (#36734)
This commit removes a duplicate "must be a" from the shrink/split error messages.
1 parent 47c923d commit 2ae0fa2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,14 +1531,14 @@ public static int getRoutingFactor(int sourceNumberOfShards, int targetNumberOfS
15311531
if (sourceNumberOfShards < targetNumberOfShards) { // split
15321532
factor = targetNumberOfShards / sourceNumberOfShards;
15331533
if (factor * sourceNumberOfShards != targetNumberOfShards || factor <= 1) {
1534-
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
1534+
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
15351535
"factor of ["
15361536
+ targetNumberOfShards + "]");
15371537
}
15381538
} else if (sourceNumberOfShards > targetNumberOfShards) { // shrink
15391539
factor = sourceNumberOfShards / targetNumberOfShards;
15401540
if (factor * targetNumberOfShards != sourceNumberOfShards || factor <= 1) {
1541-
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
1541+
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
15421542
"multiple of ["
15431543
+ targetNumberOfShards + "]");
15441544
}

server/src/test/java/org/elasticsearch/cluster/metadata/IndexMetaDataTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public void testSelectSplitShard() {
227227
assertEquals("the number of target shards (0) must be greater than the shard id: 0",
228228
expectThrows(IllegalArgumentException.class, () -> IndexMetaData.selectSplitShard(0, metaData, 0)).getMessage());
229229

230-
assertEquals("the number of source shards [2] must be a must be a factor of [3]",
230+
assertEquals("the number of source shards [2] must be a factor of [3]",
231231
expectThrows(IllegalArgumentException.class, () -> IndexMetaData.selectSplitShard(0, metaData, 3)).getMessage());
232232

233233
assertEquals("the number of routing shards [4] must be a multiple of the target shards [8]",
@@ -285,6 +285,6 @@ public void testNumberOfRoutingShards() {
285285
Settings notAFactorySettings = Settings.builder().put("index.number_of_shards", 2).put("index.number_of_routing_shards", 3).build();
286286
iae = expectThrows(IllegalArgumentException.class,
287287
() -> IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.get(notAFactorySettings));
288-
assertEquals("the number of source shards [2] must be a must be a factor of [3]", iae.getMessage());
288+
assertEquals("the number of source shards [2] must be a factor of [3]", iae.getMessage());
289289
}
290290
}

server/src/test/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void testValidateShrinkIndex() {
154154
MetaDataCreateIndexService.validateShrinkIndex(state, "source", Collections.emptySet(), "target", targetSettings)
155155

156156
).getMessage());
157-
assertEquals("the number of source shards [8] must be a must be a multiple of [3]",
157+
assertEquals("the number of source shards [8] must be a multiple of [3]",
158158
expectThrows(IllegalArgumentException.class, () ->
159159
MetaDataCreateIndexService.validateShrinkIndex(createClusterState("source", 8, randomIntBetween(0, 10),
160160
Settings.builder().put("index.blocks.write", true).build()), "source", Collections.emptySet(), "target",
@@ -221,7 +221,7 @@ public void testValidateSplitIndex() {
221221
).getMessage());
222222

223223

224-
assertEquals("the number of source shards [3] must be a must be a factor of [4]",
224+
assertEquals("the number of source shards [3] must be a factor of [4]",
225225
expectThrows(IllegalArgumentException.class, () ->
226226
MetaDataCreateIndexService.validateSplitIndex(createClusterState("source", 3, randomIntBetween(0, 10),
227227
Settings.builder().put("index.blocks.write", true).build()), "source", Collections.emptySet(), "target",

0 commit comments

Comments
 (0)