Skip to content

Commit 4f9196a

Browse files
committed
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 6956890 commit 4f9196a

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
@@ -1534,14 +1534,14 @@ public static int getRoutingFactor(int sourceNumberOfShards, int targetNumberOfS
15341534
if (sourceNumberOfShards < targetNumberOfShards) { // split
15351535
factor = targetNumberOfShards / sourceNumberOfShards;
15361536
if (factor * sourceNumberOfShards != targetNumberOfShards || factor <= 1) {
1537-
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
1537+
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
15381538
"factor of ["
15391539
+ targetNumberOfShards + "]");
15401540
}
15411541
} else if (sourceNumberOfShards > targetNumberOfShards) { // shrink
15421542
factor = sourceNumberOfShards / targetNumberOfShards;
15431543
if (factor * targetNumberOfShards != sourceNumberOfShards || factor <= 1) {
1544-
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
1544+
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
15451545
"multiple of ["
15461546
+ targetNumberOfShards + "]");
15471547
}

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
@@ -138,7 +138,7 @@ public void testValidateShrinkIndex() {
138138
MetaDataCreateIndexService.validateShrinkIndex(state, "source", Collections.emptySet(), "target", targetSettings)
139139

140140
).getMessage());
141-
assertEquals("the number of source shards [8] must be a must be a multiple of [3]",
141+
assertEquals("the number of source shards [8] must be a multiple of [3]",
142142
expectThrows(IllegalArgumentException.class, () ->
143143
MetaDataCreateIndexService.validateShrinkIndex(createClusterState("source", 8, randomIntBetween(0, 10),
144144
Settings.builder().put("index.blocks.write", true).build()), "source", Collections.emptySet(), "target",
@@ -205,7 +205,7 @@ public void testValidateSplitIndex() {
205205
).getMessage());
206206

207207

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

0 commit comments

Comments
 (0)