lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [lucene-solr] branch branch_8x updated: SOLR-13454: Investigate ReindexCollectionTest failures
Date Thu, 09 May 2019 19:57:11 GMT
This is an automated email from the ASF dual-hosted git repository.

erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 8bac8a7  SOLR-13454: Investigate ReindexCollectionTest failures
8bac8a7 is described below

commit 8bac8a70a1ff4ea12dfdd65e2de4c0fb7c7b66a5
Author: Erick Erickson <Erick.Erickson@gmail.com>
AuthorDate: Thu May 9 12:45:47 2019 -0700

    SOLR-13454: Investigate ReindexCollectionTest failures
    
    (cherry picked from commit 577be08bf278e90df6c119b0b50498828e1879d4)
---
 .../apache/solr/cloud/DocValuesNotIndexedTest.java |  8 ++++----
 .../apache/solr/cloud/ReindexCollectionTest.java   | 12 ++++++++++++
 .../src/java/org/apache/solr/SolrTestCaseJ4.java   | 22 ++++++++++++++++++++--
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java b/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
index 68a76ff..a1c5961 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DocValuesNotIndexedTest.java
@@ -179,7 +179,7 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
     CloudSolrClient client = cluster.getSolrClient();
     client.deleteByQuery("*:*");
     client.commit();
-    Solr11035BandAid(client, COLLECTION, "id", 0, "*:*");
+    Solr11035BandAid(client, COLLECTION, "id", 0, "*:*", "DocValuesNotINdexedTest.clean");
     resetFields(fieldsToTestSingle);
     resetFields(fieldsToTestMulti);
     resetFields(fieldsToTestGroupSortFirst);
@@ -255,7 +255,7 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
     new UpdateRequest()
         .add(docs)
         .commit(client, COLLECTION);
-    Solr11035BandAid(client, COLLECTION, "id", 4, "*:*");
+    Solr11035BandAid(client, COLLECTION, "id", 4, "*:*", "DocValuesNotINdexedTest.testGroupSorting");
 
     checkSortOrder(client, fieldsToTestGroupSortFirst, "asc", new String[]{"4", "2", "1",
"3"}, new String[]{"4", "1", "2", "3"});
     checkSortOrder(client, fieldsToTestGroupSortFirst, "desc", new String[]{"3", "1", "2",
"4"}, new String[]{"2", "3", "1", "4"});
@@ -298,7 +298,7 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
         .add(docs)
         .commit(client, COLLECTION);
 
-    Solr11035BandAid(client, COLLECTION, "id", 4, "*:*");
+    Solr11035BandAid(client, COLLECTION, "id", 4, "*:*", "DocValuesNotINdexedTest.testGroupingDocAbsent");
     // when grouping on any of these DV-only (not indexed) fields we expect exactly 4 groups
except for Boolean.
     for (FieldProps prop : fieldsToTestGroupSortFirst) {
       // Special handling until SOLR-9802 is fixed
@@ -362,7 +362,7 @@ public class DocValuesNotIndexedTest extends SolrCloudTestCase {
         .add(docs)
         .commit(client, COLLECTION);
 
-    Solr11035BandAid(client, COLLECTION,"id", 59, "*:*");
+    Solr11035BandAid(client, COLLECTION,"id", 59, "*:*", "DocValuesNotINdexedTest.doGroupingDvOnly");
 
     // OK, we should have one group with 10 entries for null, a group with 1 entry and 7
groups with 7
     for (FieldProps prop : fieldProps) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java
index 6c84253..354d34c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ReindexCollectionTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.cloud.DistribStateManager;
 import org.apache.solr.client.solrj.cloud.SolrCloudManager;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
@@ -139,6 +140,10 @@ public class ReindexCollectionTest extends SolrCloudTestCase {
     });
     // verify the target docs exist
     QueryResponse queryResponse = solrClient.query(targetCollection, params(CommonParams.Q,
"*:*"));
+
+    SolrTestCaseJ4.Solr11035BandAid(solrClient, targetCollection, "id", NUM_DOCS, "*:*",
+        "ReindexCollectionTest.testBasicReindexing", true);
+
     assertEquals("copied num docs", NUM_DOCS, queryResponse.getResults().getNumFound());
   }
 
@@ -177,6 +182,8 @@ public class ReindexCollectionTest extends SolrCloudTestCase {
     });
     // verify the target docs exist
     QueryResponse rsp = solrClient.query(targetCollection, params(CommonParams.Q, "*:*"));
+    SolrTestCaseJ4.Solr11035BandAid(solrClient, targetCollection, "id", NUM_DOCS, "*:*",
+        "ReindexCollectionTest.testSameTargetReindex", true);
     assertEquals("copied num docs", NUM_DOCS, rsp.getResults().getNumFound());
   }
 
@@ -205,6 +212,8 @@ public class ReindexCollectionTest extends SolrCloudTestCase {
     });
     // verify the target docs exist
     QueryResponse rsp = solrClient.query(targetCollection, params(CommonParams.Q, "*:*"));
+    SolrTestCaseJ4.Solr11035BandAid(solrClient, targetCollection, "id", NUM_DOCS, "*:*",
+        "ReindexCollectionTest.testLossyScherma", true);
     assertEquals("copied num docs", NUM_DOCS, rsp.getResults().getNumFound());
     for (SolrDocument doc : rsp.getResults()) {
       String id = (String)doc.getFieldValue("id");
@@ -240,6 +249,9 @@ public class ReindexCollectionTest extends SolrCloudTestCase {
     });
     // verify the target docs exist
     QueryResponse rsp = solrClient.query(targetCollection, params(CommonParams.Q, "*:*"));
+
+    SolrTestCaseJ4.Solr11035BandAid(solrClient, targetCollection, "id", 11, "*:*",
+        "ReindexCollectionTest.testReshapeReindexTarget", true);
     // 10 and 100-109
     assertEquals("copied num docs", 11, rsp.getResults().getNumFound());
     // verify the correct fields exist
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index b6541ab..e752c7a 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -3032,10 +3032,26 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
    * @param idField - the uniqueKey for this collection. This MUST be a string
    * @param expectedDocCount - numFound for the query
    * @param query - The Solr query to check for expectedDocCount.
+   * @param tag - additional information to display on a failure. Often class.method is useful.
    */
 
   public static void Solr11035BandAid(SolrClient client, String collection, String idField,
-                                      long expectedDocCount, String query) throws IOException,
SolrServerException {
+                                      long expectedDocCount, String query,
+                                      String tag) throws IOException, SolrServerException
{
+
+    Solr11035BandAid(client, collection, idField, expectedDocCount, query, tag, false);
+  }
+
+  // Pass true for failAnyway to have this bandaid fail if
+  // 1> it had to attempt the repair
+  // 2> it would have successfully repaired it
+  //
+  // This is useful for verifying that SOLR-11035.
+  //
+  public static void Solr11035BandAid(SolrClient client, String collection, String idField,
+                                      long expectedDocCount, String query, String tag,
+                                      boolean failAnyway) throws IOException, SolrServerException
{
+
     final SolrQuery solrQuery = new SolrQuery(query);
     QueryResponse rsp = client.query(collection, solrQuery);
     long found = rsp.getResults().getNumFound();
@@ -3066,7 +3082,9 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase {
       // so change the pattern in log4j2.xml if you need to see the whole thing.
       log.error("Dumping response" + rsp.toString());
       assertEquals("Solr11035BandAid failed, counts differ after updates:", found, expectedDocCount);
+    } else if (failAnyway) {
+      fail("failAnyway == true, would have successfully repaired the collection: '" + collection
+          + "' extra info: '" + tag + "'");
     }
-
   }
 }


Mime
View raw message