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
This commit is contained in:
Nhat Nguyen 2018-01-26 17:14:10 -05:00
parent 3d19006cfa
commit 414b5de661
1 changed files with 2 additions and 2 deletions

View File

@ -154,7 +154,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
public void testShrinkIndexPrimaryTerm() throws Exception { public void testShrinkIndexPrimaryTerm() throws Exception {
final List<Integer> factors = Arrays.asList(2, 3, 5, 7); final List<Integer> factors = Arrays.asList(2, 3, 5, 7);
final List<Integer> numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size()), factors); final List<Integer> numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size() - 1), factors);
final int numberOfShards = numberOfShardsFactors.stream().reduce(1, (x, y) -> x * y); final int numberOfShards = numberOfShardsFactors.stream().reduce(1, (x, y) -> x * y);
final int numberOfTargetShards = randomSubsetOf(numberOfShardsFactors).stream().reduce(1, (x, y) -> x * y); final int numberOfTargetShards = randomSubsetOf(numberOfShardsFactors).stream().reduce(1, (x, y) -> x * y);
internalCluster().ensureAtLeastNumDataNodes(2); internalCluster().ensureAtLeastNumDataNodes(2);
@ -165,7 +165,7 @@ public class ShrinkIndexIT extends ESIntegTestCase {
assertThat(dataNodes.size(), greaterThanOrEqualTo(2)); assertThat(dataNodes.size(), greaterThanOrEqualTo(2));
final DiscoveryNode[] discoveryNodes = dataNodes.values().toArray(DiscoveryNode.class); final DiscoveryNode[] discoveryNodes = dataNodes.values().toArray(DiscoveryNode.class);
final String mergeNode = discoveryNodes[0].getName(); 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)); ensureGreen(TimeValue.timeValueSeconds(120));
// fail random primary shards to force primary terms to increase // fail random primary shards to force primary terms to increase