Apache Lucene open-source search software
SOLR-9712: block when maxWarmingSearchers is exceeded instead of throwing exception, default to 1, remove from most configs
yonikc9522a393661
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 73b0e9b8539..c9205758a80 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -114,6 +114,12 @@ Upgrade Notesfor a listing of highlight parameters annotated with which highlighters use them.hl.useFastVectorHighlighter is now considered deprecated in lieu of hl.method=fastVector.+* SOLR-9712: maxWarmingSearchers now defaults to 1, and more importantly commits will now block if this+ limit is exceeded instead of throwing an exception (a good thing). Consequently there is no longer a+ risk in overlapping commits. Nonetheless users should continue to avoid excessive committing. Users are+ advised to remove any pre-existing maxWarmingSearchers entries from their solrconfig.xml files.++New Features----------------------* SOLR-9293: Solrj client support for hierarchical clusters and other topicsdiff --git a/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/solrconfig.xml b/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/solrconfig.xmlindex 5e0e66c69c7..64822861eeb 100644--- a/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/solrconfig.xml+++ b/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/solrconfig.xml@@ -212,11 +212,6 @@warming. --><useColdSearcher>false</useColdSearcher>- <!-- Maximum number of searchers that may be warming in the background- concurrently. An error is returned if this limit is exceeded. Recommend- 1-2 for read-only slaves, higher for masters w/o cache warming. -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query><!--diff --git a/solr/contrib/ltr/example/solrconfig.xml b/solr/contrib/ltr/example/solrconfig.xmlindex 55da6a42d05..1c66c4995da 100644--- a/solr/contrib/ltr/example/solrconfig.xml+++ b/solr/contrib/ltr/example/solrconfig.xml@@ -609,17 +609,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/contrib/morphlines-core/src/test-files/solr/solrcloud/conf/solrconfig.xml b/solr/contrib/morphlines-core/src/test-files/solr/solrcloud/conf/solrconfig.xmlindex 1eda53e8f41..42ab0565f07 100644--- a/solr/contrib/morphlines-core/src/test-files/solr/solrcloud/conf/solrconfig.xml+++ b/solr/contrib/morphlines-core/src/test-files/solr/solrcloud/conf/solrconfig.xml@@ -606,17 +606,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>4</maxWarmingSearchers>-</query>diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.javaindex e5e25a1e75b..bd980750e55 100644--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java@@ -287,7 +287,7 @@ public class SolrConfig extends Config implements MapSerializable {} else {jmxConfig = new JmxConfiguration(false, null, null, null);}- maxWarmingSearchers = getInt("query/maxWarmingSearchers", Integer.MAX_VALUE);+ maxWarmingSearchers = getInt("query/maxWarmingSearchers", 1);slowQueryThresholdMillis = getInt("query/slowQueryThresholdMillis", -1);for (SolrPluginInfo plugin : plugins) loadPluginInfo(plugin);diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.javaindex a459bf2e9b1..b3facefd7b6 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java@@ -1886,51 +1886,57 @@ public final class SolrCore implements SolrInfoMBean, Closeable {// if it isn't necessary.synchronized (searcherLock) {- // see if we can return the current searcher- if (_searcher!=null && !forceNew) {- if (returnSearcher) {- _searcher.incref();- return _searcher;- } else {- return null;+ for(;;) { // this loop is so w can retry in the event that we exceed maxWarmingSearchers+ // see if we can return the current searcher+ if (_searcher != null && !forceNew) {+ if (returnSearcher) {+ _searcher.incref();+ return _searcher;+ } else {+ return null;+ }}- }- // check to see if we can wait for someone else's searcher to be set- if (onDeckSearchers>0 && !forceNew && _searcher==null) {- try {- searcherLock.wait();- } catch (InterruptedException e) {- log.info(SolrException.toStr(e));+ // check to see if we can wait for someone else's searcher to be set+ if (onDeckSearchers > 0 && !forceNew && _searcher == null) {+ try {+ searcherLock.wait();+ } catch (InterruptedException e) {+ log.info(SolrException.toStr(e));+ }}- }- // check again: see if we can return right now- if (_searcher!=null && !forceNew) {- if (returnSearcher) {- _searcher.incref();- return _searcher;- } else {- return null;+ // check again: see if we can return right now+ if (_searcher != null && !forceNew) {+ if (returnSearcher) {+ _searcher.incref();+ return _searcher;+ } else {+ return null;+ }}- }- // At this point, we know we need to open a new searcher...- // first: increment count to signal other threads that we are- // opening a new searcher.- onDeckSearchers++;- if (onDeckSearchers < 1) {- // should never happen... just a sanity check- log.error(logid+"ERROR!!! onDeckSearchers is " + onDeckSearchers);- onDeckSearchers=1; // reset- } else if (onDeckSearchers > maxWarmingSearchers) {- onDeckSearchers--;- String msg="Error opening new searcher. exceeded limit of maxWarmingSearchers="+maxWarmingSearchers + ", try again later.";- log.warn(logid+""+ msg);- // HTTP 503==service unavailable, or 409==Conflict- throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,msg);- } else if (onDeckSearchers > 1) {- log.warn(logid+"PERFORMANCE WARNING: Overlapping onDeckSearchers=" + onDeckSearchers);+ // At this point, we know we need to open a new searcher...+ // first: increment count to signal other threads that we are+ // opening a new searcher.+ onDeckSearchers++;+ if (onDeckSearchers < 1) {+ // should never happen... just a sanity check+ log.error(logid + "ERROR!!! onDeckSearchers is " + onDeckSearchers);+ onDeckSearchers = 1; // reset+ } else if (onDeckSearchers > maxWarmingSearchers) {+ onDeckSearchers--;+ try {+ searcherLock.wait();+ } catch (InterruptedException e) {+ log.info(SolrException.toStr(e));+ }+ continue; // go back to the top of the loop and retry+ } else if (onDeckSearchers > 1) {+ log.warn(logid + "PERFORMANCE WARNING: Overlapping onDeckSearchers=" + onDeckSearchers);+ }++ break; // I can now exit the loop and proceed to open a searcher}}diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig_perf.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig_perf.xmlindex 8bd2dbb881c..c0b297fdddf 100644--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig_perf.xml+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig_perf.xml@@ -57,7 +57,6 @@<queryResultWindowSize>20</queryResultWindowSize><queryResultMaxDocsCached>200</queryResultMaxDocsCached><useColdSearcher>false</useColdSearcher>- <maxWarmingSearchers>2</maxWarmingSearchers></query>diff --git a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.javaindex 51eaf342f30..28ecaa30f6e 100644--- a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java+++ b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java@@ -513,7 +513,7 @@ public class TestRealTimeGet extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 5 + random().nextInt(25);- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads; // number of committers at a time...// query variablesfinal int percentRealtimeQuery = 60;diff --git a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java b/solr/core/src/test/org/apache/solr/search/TestStressLucene.javaindex 94cf300ed93..779be435ba6 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java@@ -55,7 +55,7 @@ public class TestStressLucene extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 5 + random().nextInt(25);- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;final AtomicLong operations = new AtomicLong(100000); // number of query operations to perform in totalint nReadThreads = 5 + random().nextInt(25);diff --git a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.javaindex 412908d0a5f..b6ecc2e75e2 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java@@ -70,7 +70,7 @@ public class TestStressRecovery extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 2 + random().nextInt(10); // fewer write threads to give recovery thread more of a chance- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 75;diff --git a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java b/solr/core/src/test/org/apache/solr/search/TestStressReorder.javaindex 4415946bc85..bce1d75af2a 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java@@ -68,8 +68,7 @@ public class TestStressReorder extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 5 + random().nextInt(25);- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers-+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 75;final AtomicLong operations = new AtomicLong(50000); // number of query operations to perform in total@@ -84,7 +83,7 @@ public class TestStressReorder extends TestRTGBase {final int ndocs = 1;int nWriteThreads = 2;- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 101;diff --git a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.javaindex e098ecc445d..4eea434b162 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java@@ -74,7 +74,7 @@ public class TestStressUserVersions extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 5 + random().nextInt(25);- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 75;@@ -90,7 +90,7 @@ public class TestStressUserVersions extends TestRTGBase {final int ndocs = 1;int nWriteThreads = 2;- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 101;diff --git a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressVersions.javaindex d91a2cc6a96..ed51ae5e074 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressVersions.java@@ -56,7 +56,7 @@ public class TestStressVersions extends TestRTGBase {final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));int nWriteThreads = 5 + random().nextInt(25);- final int maxConcurrentCommits = nWriteThreads; // number of committers at a time... it should be <= maxWarmingSearchers+ final int maxConcurrentCommits = nWriteThreads;// query variablesfinal int percentRealtimeQuery = 75;diff --git a/solr/example/example-DIH/solr/db/conf/solrconfig.xml b/solr/example/example-DIH/solr/db/conf/solrconfig.xmlindex 6a3047396ab..71d8f5a2e99 100644--- a/solr/example/example-DIH/solr/db/conf/solrconfig.xml+++ b/solr/example/example-DIH/solr/db/conf/solrconfig.xml@@ -581,17 +581,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml b/solr/example/example-DIH/solr/mail/conf/solrconfig.xmlindex 24da1351fc3..8bc24f5b938 100644--- a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml+++ b/solr/example/example-DIH/solr/mail/conf/solrconfig.xml@@ -584,17 +584,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/example/example-DIH/solr/rss/conf/solrconfig.xml b/solr/example/example-DIH/solr/rss/conf/solrconfig.xmlindex 224a94bc062..eae60a79956 100644--- a/solr/example/example-DIH/solr/rss/conf/solrconfig.xml+++ b/solr/example/example-DIH/solr/rss/conf/solrconfig.xml@@ -581,17 +581,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml b/solr/example/example-DIH/solr/solr/conf/solrconfig.xmlindex 2c671892566..873391b44c8 100644--- a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml+++ b/solr/example/example-DIH/solr/solr/conf/solrconfig.xml@@ -581,17 +581,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/example/example-DIH/solr/tika/conf/solrconfig.xml b/solr/example/example-DIH/solr/tika/conf/solrconfig.xmlindex 7554e176de2..ac0c22a6d3a 100644--- a/solr/example/example-DIH/solr/tika/conf/solrconfig.xml+++ b/solr/example/example-DIH/solr/tika/conf/solrconfig.xml@@ -584,17 +584,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/example/files/conf/solrconfig.xml b/solr/example/files/conf/solrconfig.xmlindex fcbc4d6cee8..3fd825ebee0 100644--- a/solr/example/files/conf/solrconfig.xml+++ b/solr/example/files/conf/solrconfig.xml@@ -579,17 +579,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml b/solr/server/solr/configsets/basic_configs/conf/solrconfig.xmlindex b0a8cdf9af0..4ef902fbfc4 100644--- a/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml+++ b/solr/server/solr/configsets/basic_configs/conf/solrconfig.xml@@ -599,17 +599,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml b/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xmlindex ea506102b2f..4b0899bbcc1 100644--- a/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml+++ b/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml@@ -599,17 +599,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xmlindex 65b348a396c..e4b0526f4e5 100644--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml@@ -611,17 +611,6 @@--><useColdSearcher>false</useColdSearcher>- <!-- Max Warming Searchers-- Maximum number of searchers that may be warming in the- background concurrently. An error is returned if this limit- is exceeded.-- Recommend values of 1-2 for read-only slaves, higher for- masters w/o cache warming.- -->- <maxWarmingSearchers>2</maxWarmingSearchers>-</query>diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.javaindex b9d525ce27e..8f43c3314c5 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/LargeVolumeTestBase.java@@ -60,7 +60,8 @@ public abstract class LargeVolumeTestBase extends SolrJettyTestBase// some of the commits could have failed because maxWarmingSearchers exceeded,// so do a final commit to make sure everything is visible.- client.commit();+ // This should no longer be true as of SOLR-9712 (Solr 6.4)+ // client.commit();query(threadCount * numdocs);log.info("done");diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.javaindex ce762a0120f..114d8ed2e11 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTestBase.java@@ -38,7 +38,6 @@ abstract public class SolrExampleTestBase extends AbstractSolrTestCase {@Overridepublic void setUp() throws Exception {- ignoreException("maxWarmingSearchers");super.setUp();// this sets the property for jetty starting SolrDispatchFilterdiff --git a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.javaindex 0badec1e702..a936ee5066d 100644--- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java+++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java@@ -110,8 +110,6 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4nodeProps.setProperty("coreRootDirectory", coresDir.toString());nodeProps.setProperty("configSetBaseDir", solrHome);- ignoreException("maxWarmingSearchers");-jetty = new JettySolrRunner(solrHome, nodeProps, jettyConfig);jetty.start();port = jetty.getLocalPort();