Apache Lucene open-source search software
SOLR-11200: A new CMS config option 'ioThrottle' to manually enable/disable ConcurrentMergeSchedule.doAutoIOThrottle. (Amrit Sarkar, Nawab Zada Asad iqbal)
Dawid Weiss4eead83a8323
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex be3f7042303..516a0d794ec 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -69,6 +69,9 @@ Upgrade NotesNew Features----------------------+* SOLR-11200: A new CMS config option 'ioThrottle' to manually enable/disable+ ConcurrentMergeSchedule.doAutoIOThrottle. (Amrit Sarkar, Nawab Zada Asad iqbal via Dawid Weiss)+* SOLR-11670: Implement a periodic house-keeping task. This uses a scheduled autoscaling trigger andcurrently performs cleanup of old inactive shards. (ab, shalin)diff --git a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.javaindex c663783e83c..48b241751b8 100644--- a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java+++ b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java@@ -299,6 +299,10 @@ public class SolrIndexConfig implements MapSerializable {maxThreadCount = ((ConcurrentMergeScheduler) scheduler).getMaxThreadCount();}((ConcurrentMergeScheduler)scheduler).setMaxMergesAndThreads(maxMergeCount, maxThreadCount);+ Boolean ioThrottle = (Boolean) args.remove("ioThrottle");+ if (ioThrottle != null && !ioThrottle) { //by-default 'enabled'+ ((ConcurrentMergeScheduler) scheduler).disableAutoIOThrottle();+ }SolrPluginUtils.invokeSetters(scheduler, args);} else {SolrPluginUtils.invokeSetters(scheduler, mergeSchedulerInfo.initArgs);diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-concurrentmergescheduler.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-concurrentmergescheduler.xmlnew file mode 100644index 00000000000..140c4cfeedc--- /dev/null+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-concurrentmergescheduler.xml@@ -0,0 +1,37 @@+<?xml version="1.0" ?>++<!--+ Licensed to the Apache Software Foundation (ASF) under one or more+ contributor license agreements. See the NOTICE file distributed with+ this work for additional information regarding copyright ownership.+ The ASF licenses this file to You under the Apache License, Version 2.0+ (the "License"); you may not use this file except in compliance with+ the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+-->++<config>+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>+ <schemaFactory class="ClassicIndexSchemaFactory"/>++ <indexConfig>+ <useCompoundFile>${useCompoundFile:false}</useCompoundFile>+ <mergePolicyFactory class="org.apache.solr.index.TieredMergePolicyFactory" />+ <mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler">+ <int name="maxMergeCount">987</int>+ <int name="maxThreadCount">42</int>+ <bool name="ioThrottle">false</bool>+ </mergeScheduler>+ </indexConfig>++ <requestHandler name="/select" class="solr.SearchHandler"></requestHandler>++</config>diff --git a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.javaindex ec5719ca3df..d5ebf051d9f 100644--- a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java+++ b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java@@ -48,6 +48,7 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 {private static final String solrConfigFileName = "solrconfig.xml";private static final String solrConfigFileNameWarmerRandomMergePolicyFactory = "solrconfig-warmer-randommergepolicyfactory.xml";private static final String solrConfigFileNameTieredMergePolicyFactory = "solrconfig-tieredmergepolicyfactory.xml";+ private static final String solrConfigFileNameConnMSPolicyFactory = "solrconfig-concurrentmergescheduler.xml";private static final String solrConfigFileNameSortingMergePolicyFactory = "solrconfig-sortingmergepolicyfactory.xml";private static final String schemaFileName = "schema.xml";@@ -93,6 +94,29 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 {ConcurrentMergeScheduler ms = (ConcurrentMergeScheduler) iwc.getMergeScheduler();assertEquals("ms.maxMergeCount", 987, ms.getMaxMergeCount());assertEquals("ms.maxThreadCount", 42, ms.getMaxThreadCount());+ assertEquals("ms.isAutoIOThrottle", true, ms.getAutoIOThrottle());++ }++ @Test+ public void testConcurrentMergeSchedularSolrIndexConfigCreation() throws Exception {+ String solrConfigFileName = solrConfigFileNameConnMSPolicyFactory;+ SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileName, null);+ SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null);+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig);++ h.getCore().setLatestSchema(indexSchema);+ IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(h.getCore());++ assertNotNull("null mp", iwc.getMergePolicy());+ assertTrue("mp is not TieredMergePolicy", iwc.getMergePolicy() instanceof TieredMergePolicy);++ assertNotNull("null ms", iwc.getMergeScheduler());+ assertTrue("ms is not CMS", iwc.getMergeScheduler() instanceof ConcurrentMergeScheduler);+ ConcurrentMergeScheduler ms = (ConcurrentMergeScheduler) iwc.getMergeScheduler();+ assertEquals("ms.maxMergeCount", 987, ms.getMaxMergeCount());+ assertEquals("ms.maxThreadCount", 42, ms.getMaxThreadCount());+ assertEquals("ms.isAutoIOThrottle", false, ms.getAutoIOThrottle());}