Apache Solr open-source search software
SOLR-13370 - Trying reduction of cluster size, but not clear that should help from local tests/profile, but maybe it helps in more memory constrained build servers, this and prior version both beasted success 10 rounds of 5 on a machine with lots of memory.
Gus Heck4a9319980383
diff --git a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.javaindex 77ecb22da94..0965e3cea29 100644--- a/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/CategoryRoutedAliasUpdateProcessorTest.java@@ -64,10 +64,14 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProprivate int lastDocId = 0;private static CloudSolrClient solrClient;private int numDocsDeletedOrFailed = 0;+ // uncomment to create pause for attaching profiler.+// static {+// JOptionPane.showMessageDialog(null,"Ready?");+// }@Beforepublic void doBefore() throws Exception {- configureCluster(4).configure();+ configureCluster(1).configure();solrClient = getCloudSolrClient(cluster);//log this to help debug potential causes of problemslog.info("SolrClient: {}", solrClient);@@ -85,6 +89,8 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProIOUtils.close(solrClient);}+ @Test+ @Slowpublic void testNonEnglish() throws Exception {// test to document the expected behavior with non-english text for categories// the present expectation is that non-latin text and many accented latin characters@@ -128,7 +134,7 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProCollectionAdminRequest.createCategoryRoutedAlias(getAlias(), categoryField, 20,CollectionAdminRequest.createCollection("_unused_", configName, 1, 1)- .setMaxShardsPerNode(2))+ .setMaxShardsPerNode(12)).process(solrClient);addDocsAndCommit(true,newDoc(somethingInChinese),@@ -188,7 +194,6 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdatePro// now we index a documentaddDocsAndCommit(true, newDoc(SHIPS[0]));- //assertDocRoutedToCol(lastDocId, col23rd);String uninitialized = getAlias() + "__CRA__" + CategoryRoutedAlias.UNINITIALIZED;assertInvariants(colVogon, uninitialized);@@ -357,7 +362,7 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProfinal int numReplicas = 1 + random().nextInt(3);CollectionAdminRequest.createCategoryRoutedAlias(getAlias(), categoryField, 20,CollectionAdminRequest.createCollection("_unused_", configName, numShards, numReplicas)- .setMaxShardsPerNode(numReplicas))+ .setMaxShardsPerNode(numReplicas*numShards)).process(solrClient);// cause some collections to be created@@ -397,36 +402,42 @@ public class CategoryRoutedAliasUpdateProcessorTest extends RoutedAliasUpdatePro}+ /*+ * We expect the following invariants:+ * 1.) to see all the supplied collections+ * 2.) Independently Querying all collections we can find to yield the same number of docs as querying the alias+ * 3.) find as many docs as have been added but not deleted/failed+ */private void assertInvariants(String... expectedColls) throws IOException, SolrServerException {final int expectNumFound = lastDocId - numDocsDeletedOrFailed; //lastDocId is effectively # generated docs- List<String> cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(getAlias());- cols = new ArrayList<>(cols);- cols.sort(String::compareTo); // don't really care about the order here.- assert !cols.isEmpty();+ List<String> observedCols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(getAlias());+ observedCols = new ArrayList<>(observedCols);+ observedCols.sort(String::compareTo); // don't really care about the order here.+ assert !observedCols.isEmpty();- int totalNumFound = 0;- for (String col : cols) {+ int numFoundViaCollections = 0;+ for (String col : observedCols) {final QueryResponse colResponse = solrClient.query(col, params("q", "*:*","rows", "0"));long numFound = colResponse.getResults().getNumFound();if (numFound > 0) {- totalNumFound += numFound;+ numFoundViaCollections += numFound;}}final QueryResponse colResponse = solrClient.query(getAlias(), params("q", "*:*","rows", "0"));- long aliasNumFound = colResponse.getResults().getNumFound();- List<String> actual = Arrays.asList(expectedColls);- actual.sort(String::compareTo);- assertArrayEquals("Expected " + expectedColls.length + " collections, found " + cols.size() + ":\n" +- cols + " vs \n" + actual, expectedColls, cols.toArray());+ long numFoundViaAlias = colResponse.getResults().getNumFound();+ List<String> expectedList = Arrays.asList(expectedColls);+ expectedList.sort(String::compareTo);+ assertArrayEquals("Expected " + expectedColls.length + " collections, found " + observedCols.size() + ":\n" ++ observedCols + " vs \n" + expectedList, expectedColls, observedCols.toArray());assertEquals("Expected collections and alias to have same number of documents",- aliasNumFound, totalNumFound);- assertEquals("Expected to find " + expectNumFound + " docs but found " + aliasNumFound,- expectNumFound, aliasNumFound);+ numFoundViaAlias, numFoundViaCollections);+ assertEquals("Expected to find " + expectNumFound + " docs but found " + numFoundViaAlias,+ expectNumFound, numFoundViaAlias);}private SolrInputDocument newDoc(String routedValue) {