diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index c6e6f130b23..2cc9710527b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -126,6 +126,9 @@ New Features * SOLR-14604: Add the ability to uninstall a package from with the Package CLI. (MarcusSorealheis) +* SOLR-14582: Expose IWC.setMaxCommitMergeWaitMillis in Solr's index config. This is an expert config option that can be + set when using a custom MergePolicy (doesn't have any effect on the default MP) (Tomás Fernández Löbbe) + Improvements --------------------- diff --git a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java index e189ad16b46..50bda0ef67f 100644 --- a/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java +++ b/solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java @@ -68,6 +68,19 @@ public class SolrIndexConfig implements MapSerializable { public final double ramBufferSizeMB; public final int ramPerThreadHardLimitMB; + /** + *
+ * When using a custom merge policy that allows triggering synchronous merges on commit
+ * (see {@link MergePolicy#findFullFlushMerges(org.apache.lucene.index.MergeTrigger, org.apache.lucene.index.SegmentInfos, org.apache.lucene.index.MergePolicy.MergeContext)}),
+ * a timeout (in milliseconds) can be set for those merges to finish. Use {@code
+ * Note that as of Solr 8.6, no {@code MergePolicy} shipped with Lucene/Solr make use of + * {@code MergePolicy.findFullFlushMerges}, which means this setting has no effect unless a custom {@code MergePolicy} is used. + *
+ */ + public final int maxCommitMergeWaitMillis; public final int writeLockTimeout; public final String lockType; @@ -87,6 +100,7 @@ public class SolrIndexConfig implements MapSerializable { maxBufferedDocs = -1; ramBufferSizeMB = 100; ramPerThreadHardLimitMB = -1; + maxCommitMergeWaitMillis = -1; writeLockTimeout = -1; lockType = DirectoryFactory.LOCK_TYPE_NATIVE; mergePolicyFactoryInfo = null; @@ -129,8 +143,9 @@ public class SolrIndexConfig implements MapSerializable { true); useCompoundFile = solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile); - maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs); + maxBufferedDocs = solrConfig.getInt(prefix+"/maxBufferedDocs", def.maxBufferedDocs); ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB); + maxCommitMergeWaitMillis = solrConfig.getInt(prefix+"/maxCommitMergeWaitTime", def.maxCommitMergeWaitMillis); // how do we validate the value?? ramPerThreadHardLimitMB = solrConfig.getInt(prefix+"/ramPerThreadHardLimitMB", def.ramPerThreadHardLimitMB); @@ -185,6 +200,7 @@ public class SolrIndexConfig implements MapSerializable { "maxBufferedDocs", maxBufferedDocs, "ramBufferSizeMB", ramBufferSizeMB, "ramPerThreadHardLimitMB", ramPerThreadHardLimitMB, + "maxCommitMergeWaitTime", maxCommitMergeWaitMillis, "writeLockTimeout", writeLockTimeout, "lockType", lockType, "infoStreamEnabled", infoStream != InfoStream.NO_OUTPUT); @@ -230,6 +246,10 @@ public class SolrIndexConfig implements MapSerializable { if (ramPerThreadHardLimitMB != -1) { iwc.setRAMPerThreadHardLimitMB(ramPerThreadHardLimitMB); } + + if (maxCommitMergeWaitMillis > 0) { + iwc.setMaxCommitMergeWaitMillis(maxCommitMergeWaitMillis); + } iwc.setSimilarity(schema.getSimilarity()); MergePolicy mergePolicy = buildMergePolicy(core.getResourceLoader(), schema); diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml index 20ddf96df42..de5c714aa23 100644 --- a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml +++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml @@ -32,6 +32,7 @@ A solrconfig.xml snippet containing indexConfig settings for randomized testing.