You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by is...@apache.org on 2024/04/15 18:38:52 UTC
(solr) branch jira/solr-13350 updated: SOLR-13350: Request parameter 'multithreaded' to disable/enable multithreading
This is an automated email from the ASF dual-hosted git repository.
ishan pushed a commit to branch jira/solr-13350
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/jira/solr-13350 by this push:
new f7f96f1d393 SOLR-13350: Request parameter 'multithreaded' to disable/enable multithreading
f7f96f1d393 is described below
commit f7f96f1d393592803111100c118cc7e5ba82a6ea
Author: Ishan Chattopadhyaya <is...@apache.org>
AuthorDate: Tue Apr 16 00:08:36 2024 +0530
SOLR-13350: Request parameter 'multithreaded' to disable/enable multithreading
---
.../java/org/apache/solr/search/MultiThreadedSearcher.java | 6 ++++++
.../src/test/org/apache/solr/search/TestCpuAllowedLimit.java | 8 ++++++--
.../src/test/org/apache/solr/search/TestQueryLimits.java | 12 +++++++++++-
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/search/MultiThreadedSearcher.java b/solr/core/src/java/org/apache/solr/search/MultiThreadedSearcher.java
index fc97a9488bf..328512a8858 100644
--- a/solr/core/src/java/org/apache/solr/search/MultiThreadedSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/MultiThreadedSearcher.java
@@ -39,6 +39,7 @@ import org.apache.lucene.search.TopDocsCollector;
import org.apache.lucene.search.TopFieldDocs;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.automaton.ByteRunAutomaton;
+import org.apache.solr.request.SolrRequestInfo;
import org.apache.solr.search.join.GraphQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -120,6 +121,11 @@ public class MultiThreadedSearcher {
}
static boolean allowMT(DelegatingCollector postFilter, QueryCommand cmd, Query query) {
+ boolean multithreaded =
+ SolrRequestInfo.getRequestInfo().getReq().getParams().getBool("multithreaded", true);
+ if (!multithreaded) {
+ return false;
+ }
if (postFilter != null || cmd.getSegmentTerminateEarly() || cmd.getTimeAllowed() > 0) {
return false;
} else {
diff --git a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java
index dac4ec5124c..126a71eb044 100644
--- a/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java
+++ b/solr/core/src/test/org/apache/solr/search/TestCpuAllowedLimit.java
@@ -185,7 +185,9 @@ public class TestCpuAllowedLimit extends SolrCloudTestCase {
"stages",
"prepare,process",
"cpuAllowed",
- "50"));
+ "50",
+ "multithreaded",
+ "false"));
// System.err.println("rsp=" + rsp.jsonStr());
assertNotNull("should have partial results", rsp.getHeader().get("partialResults"));
@@ -204,7 +206,9 @@ public class TestCpuAllowedLimit extends SolrCloudTestCase {
"stages",
"prepare,process",
"cpuAllowed",
- "50"));
+ "50",
+ "multithreaded",
+ "false"));
// System.err.println("rsp=" + rsp.jsonStr());
assertNotNull("should have partial results", rsp.getHeader().get("partialResults"));
}
diff --git a/solr/core/src/test/org/apache/solr/search/TestQueryLimits.java b/solr/core/src/test/org/apache/solr/search/TestQueryLimits.java
index 6e413f6bfd2..2d490363f89 100644
--- a/solr/core/src/test/org/apache/solr/search/TestQueryLimits.java
+++ b/solr/core/src/test/org/apache/solr/search/TestQueryLimits.java
@@ -76,7 +76,17 @@ public class TestQueryLimits extends SolrCloudTestCase {
rsp =
solrClient.query(
COLLECTION,
- params("q", "id:*", "sort", "id asc", "facet", "true", "facet.field", "val_i"));
+ params(
+ "q",
+ "id:*",
+ "sort",
+ "id asc",
+ "facet",
+ "true",
+ "facet.field",
+ "val_i",
+ "multithreaded",
+ "false"));
assertNotNull(
"should have partial results for expr " + matchingExpr,
rsp.getHeader().get("partialResults"));