From 414b5de66161e11865402748c21885738e9f2770 Mon Sep 17 00:00:00 2001 From: Nhat Nguyen Date: Fri, 26 Jan 2018 17:14:10 -0500 Subject: [PATCH] TEST: Lower num of shards in testShrinkIndexPrimaryTerm In some cases testShrinkIndexPrimaryTerm creates then 'mutates' 210 shards. If each shard opens more than 10 files (translog, lucene index), we exceeded the maximum allowed file handles. In our test, the number of file handles is limited to 2048 by HandleLimitFS. This commit reduces the number of shards in testShrinkIndexPrimaryTerm to avoid such errors. Closes #28153 --- .../action/admin/indices/create/ShrinkIndexIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java b/server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java index f35bad9f128..44f7e38e3ad 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java @@ -154,7 +154,7 @@ public class ShrinkIndexIT extends ESIntegTestCase { public void testShrinkIndexPrimaryTerm() throws Exception { final List factors = Arrays.asList(2, 3, 5, 7); - final List numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size()), factors); + final List numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size() - 1), factors); final int numberOfShards = numberOfShardsFactors.stream().reduce(1, (x, y) -> x * y); final int numberOfTargetShards = randomSubsetOf(numberOfShardsFactors).stream().reduce(1, (x, y) -> x * y); internalCluster().ensureAtLeastNumDataNodes(2); @@ -165,7 +165,7 @@ public class ShrinkIndexIT extends ESIntegTestCase { assertThat(dataNodes.size(), greaterThanOrEqualTo(2)); final DiscoveryNode[] discoveryNodes = dataNodes.values().toArray(DiscoveryNode.class); final String mergeNode = discoveryNodes[0].getName(); - // This needs more than the default timeout if 210(2*3*5*7) shards were created. + // This needs more than the default timeout if a large number of shards were created. ensureGreen(TimeValue.timeValueSeconds(120)); // fail random primary shards to force primary terms to increase