Skip to content

Commit e09201a

Browse files
committed
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
1 parent 20e1d45 commit e09201a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void testCreateShrinkIndexToN() {
154154

155155
public void testShrinkIndexPrimaryTerm() throws Exception {
156156
final List<Integer> factors = Arrays.asList(2, 3, 5, 7);
157-
final List<Integer> numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size()), factors);
157+
final List<Integer> numberOfShardsFactors = randomSubsetOf(scaledRandomIntBetween(1, factors.size() - 1), factors);
158158
final int numberOfShards = numberOfShardsFactors.stream().reduce(1, (x, y) -> x * y);
159159
final int numberOfTargetShards = randomSubsetOf(numberOfShardsFactors).stream().reduce(1, (x, y) -> x * y);
160160
internalCluster().ensureAtLeastNumDataNodes(2);
@@ -165,7 +165,7 @@ public void testShrinkIndexPrimaryTerm() throws Exception {
165165
assertThat(dataNodes.size(), greaterThanOrEqualTo(2));
166166
final DiscoveryNode[] discoveryNodes = dataNodes.values().toArray(DiscoveryNode.class);
167167
final String mergeNode = discoveryNodes[0].getName();
168-
// This needs more than the default timeout if 210(2*3*5*7) shards were created.
168+
// This needs more than the default timeout if a large number of shards were created.
169169
ensureGreen(TimeValue.timeValueSeconds(120));
170170

171171
// fail random primary shards to force primary terms to increase

0 commit comments

Comments
 (0)