Skip to content
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

Fix duplicate phrase in shrink/split error message #36734

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
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 @@ -1531,14 +1531,14 @@ public static int getRoutingFactor(int sourceNumberOfShards, int targetNumberOfS
if (sourceNumberOfShards < targetNumberOfShards) { // split
factor = targetNumberOfShards / sourceNumberOfShards;
if (factor * sourceNumberOfShards != targetNumberOfShards || factor <= 1) {
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
"factor of ["
+ targetNumberOfShards + "]");
}
} else if (sourceNumberOfShards > targetNumberOfShards) { // shrink
factor = sourceNumberOfShards / targetNumberOfShards;
if (factor * targetNumberOfShards != sourceNumberOfShards || factor <= 1) {
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a must be a " +
throw new IllegalArgumentException("the number of source shards [" + sourceNumberOfShards + "] must be a " +
"multiple of ["
+ targetNumberOfShards + "]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void testSelectSplitShard() {
assertEquals("the number of target shards (0) must be greater than the shard id: 0",
expectThrows(IllegalArgumentException.class, () -> IndexMetaData.selectSplitShard(0, metaData, 0)).getMessage());

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

assertEquals("the number of routing shards [4] must be a multiple of the target shards [8]",
Expand Down Expand Up @@ -285,6 +285,6 @@ public void testNumberOfRoutingShards() {
Settings notAFactorySettings = Settings.builder().put("index.number_of_shards", 2).put("index.number_of_routing_shards", 3).build();
iae = expectThrows(IllegalArgumentException.class,
() -> IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.get(notAFactorySettings));
assertEquals("the number of source shards [2] must be a must be a factor of [3]", iae.getMessage());
assertEquals("the number of source shards [2] must be a factor of [3]", iae.getMessage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void testValidateShrinkIndex() {
MetaDataCreateIndexService.validateShrinkIndex(state, "source", Collections.emptySet(), "target", targetSettings)

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


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