From 806744b0f1563c5145c494976f2d8800050a1ab6 Mon Sep 17 00:00:00 2001 From: Chris Hostetter Date: Thu, 31 Jan 2019 10:45:12 -0700 Subject: [PATCH] reduce number of nodes/shards used in TriLevelCompositeIdRoutingTest to prevent (incredibly frequent) OOM in nightly --- .../cloud/TriLevelCompositeIdRoutingTest.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java b/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java index b78a765f66c..05a0ab952e2 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java @@ -16,7 +16,7 @@ */ package org.apache.solr.cloud; -import org.apache.lucene.util.LuceneTestCase.Slow; +import org.apache.lucene.util.TestUtil; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.junit.BeforeClass; @@ -29,15 +29,13 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Set; - -@Slow public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - int NUM_APPS = 5; - int NUM_USERS = 10; - int NUM_DOCS = 100; + final int NUM_APPS; + final int NUM_USERS; + final int NUM_DOCS; @BeforeClass @@ -52,12 +50,18 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { public TriLevelCompositeIdRoutingTest() { schemaString = "schema15.xml"; // we need a string id - sliceCount = TEST_NIGHTLY ? 12 : 2; // a lot of slices for more ranges and buckets - fixShardCount(TEST_NIGHTLY ? 24 : 3); + + + sliceCount = TestUtil.nextInt(random(), 1, (TEST_NIGHTLY ? 5 : 3)); // this is the number of *SHARDS* + int replicationFactor = rarely() ? 2 : 1; // replication is not the focus of this test + fixShardCount(replicationFactor * sliceCount); // total num cores, one per node + + NUM_APPS = atLeast(5); + NUM_USERS = atLeast(10); + NUM_DOCS = atLeast(100); } @Test - @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // annotated on: 24-Dec-2018 public void test() throws Exception { boolean testFinished = false; try { @@ -68,6 +72,8 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { waitForRecoveriesToFinish(true); doTriLevelHashingTest(); + del("*:*"); + commit(); doTriLevelHashingTestWithBitMask(); testFinished = true; @@ -98,7 +104,7 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { for (int i = 1; i <= sliceCount; i++) { - Set ids = doQueryGetUniqueIdKeys("q", "*:*", "shards", "shard" + i); + Set ids = doQueryGetUniqueIdKeys("q", "*:*", "rows", ""+NUM_DOCS, "shards", "shard" + i); for (String id : ids) { assertFalse("Found the same route key [" + id + "] in 2 shards.", idMap.containsKey(id)); idMap.put(getKey(id), i); @@ -112,7 +118,6 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { log.info("### STARTING doTriLevelHashingTestWithBitMask"); // for now, we know how ranges will be distributed to shards. // may have to look it up in clusterstate if that assumption changes. - del("*:*"); for (int i = 0; i < NUM_DOCS; i++) { int appId = r.nextInt(NUM_APPS) + 1; @@ -130,7 +135,7 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest { for (int i = 1; i <= sliceCount; i++) { - Set ids = doQueryGetUniqueIdKeys("q", "*:*", "shards", "shard" + i); + Set ids = doQueryGetUniqueIdKeys("q", "*:*", "rows", ""+NUM_DOCS, "shards", "shard" + i); for (String id : ids) { assertFalse("Found the same route key [" + id + "] in 2 shards.", idMap.containsKey(id)); idMap.put(getKey(id), i);