You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/03/03 17:48:36 UTC

[solr] branch branch_9x updated: SOLR-16071: Fix occasional failure in DistributedQueryComponentCustomSortTest

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new b2ff210  SOLR-16071: Fix occasional failure in DistributedQueryComponentCustomSortTest
b2ff210 is described below

commit b2ff21056f5e404074f41f0c2c1088d50cda0823
Author: Houston Putman <ho...@apache.org>
AuthorDate: Thu Mar 3 12:16:39 2022 -0500

    SOLR-16071: Fix occasional failure in DistributedQueryComponentCustomSortTest
    
    (cherry picked from commit 7b9f4b9ed98635beeade94857cf59bf84302fe04)
---
 .../DistributedQueryComponentCustomSortTest.java   | 42 +++++++++-------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
index 4b612e2..942cca9 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
@@ -17,14 +17,11 @@
 package org.apache.solr.handler.component;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
-import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Objects;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.solr.BaseDistributedSearchTestCase;
-import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.response.SolrQueryResponse;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -178,14 +175,10 @@ public class DistributedQueryComponentCustomSortTest extends BaseDistributedSear
     // sanity check function sorting
     rsp =
         query(
-            "q",
-            "id_i:[1 TO 10]",
-            "fl",
-            "id",
-            "rows",
-            "20",
-            "sort",
-            "abs(sub(5,id_i)) asc, id desc");
+            "q", "id_i:[1 TO 10]",
+            "fl", "id",
+            "rows", "20",
+            "sort", "abs(sub(5,id_i)) asc, id desc");
     assertFieldValues(rsp.getResults(), id, "5", "6", "4", "7", "3", "8", "2", "9", "1", "10");
 
     // Add two more docs with same payload as in doc #4
@@ -244,26 +237,23 @@ public class DistributedQueryComponentCustomSortTest extends BaseDistributedSear
         "1",
         "7");
 
-    // Regression check on timeAllowed in combination with sorting, SOLR-14758
-    // Should see either a complete result or a partial result, but never an NPE
+    // Regression check on timeAllowed in combination with sorting, SOLR-14758.
+    // Should see either a complete result or a partial result, but never an NPE.
+    // Only query a non-control client, as the control and non-control might get different partial
+    // results.
     rsp =
-        queryAllowPartialResults(
-            "q", "text:d", "fl", "id", "sort", "payload desc", "rows", "20", "timeAllowed", "1");
+        queryServer(
+            createParams(
+                "q", "text:d",
+                "fl", "id",
+                "sort", "payload desc",
+                "rows", "20",
+                "timeAllowed", "1000",
+                "shards", shards));
     if (!Objects.equals(
         Boolean.TRUE,
         rsp.getHeader().getBooleanArg(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY))) {
       assertFieldValues(rsp.getResults(), id, "11", "13", "12");
     }
   }
-
-  /**
-   * Modified version of {@link BaseDistributedSearchTestCase#query(Object...)} that allows partial
-   * results.
-   */
-  private QueryResponse queryAllowPartialResults(Object... q)
-      throws SolrServerException, IOException {
-    ModifiableSolrParams params = createParams(q);
-    setDistributedParams(params);
-    return queryServer(params);
-  }
 }