Apache Lucene open-source search software
SOLR-4426: NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB if <directoryFactory> is not present in solrconfig.xml
Shalin Shekhar Mangar03a6a161af7d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex b21a56c6125..bacb8080a8c 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -114,6 +114,9 @@ Bug Fixes* SOLR-3655: A restarted node can briefly appear live and active before it reallyis in some cases. (Mark Miller)+* SOLR-4426: NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB+ if <directoryFactory> is not present in solrconfig.xml (Jack Krupansky via shalin)+Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.javaindex dccd4afa12f..578555c0315 100644--- a/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java+++ b/solr/core/src/java/org/apache/solr/core/NRTCachingDirectoryFactory.java@@ -31,18 +31,20 @@ import org.apache.solr.core.DirectoryFactory.DirContext;* Factory to instantiate {@link org.apache.lucene.store.NRTCachingDirectory}*/public class NRTCachingDirectoryFactory extends StandardDirectoryFactory {- private double maxMergeSizeMB;- private double maxCachedMB;+ public static final int DEFAULT_MAX_MERGE_SIZE_MB = 4;+ private double maxMergeSizeMB = DEFAULT_MAX_MERGE_SIZE_MB;+ public static final int DEFAULT_MAX_CACHED_MB = 48;+ private double maxCachedMB = DEFAULT_MAX_CACHED_MB;@Overridepublic void init(NamedList args) {super.init(args);SolrParams params = SolrParams.toSolrParams(args);- maxMergeSizeMB = params.getDouble("maxMergeSizeMB", 4);+ maxMergeSizeMB = params.getDouble("maxMergeSizeMB", DEFAULT_MAX_MERGE_SIZE_MB);if (maxMergeSizeMB <= 0){throw new IllegalArgumentException("maxMergeSizeMB must be greater than 0");}- maxCachedMB = params.getDouble("maxCachedMB", 48);+ maxCachedMB = params.getDouble("maxCachedMB", DEFAULT_MAX_CACHED_MB);if (maxCachedMB <= 0){throw new IllegalArgumentException("maxCachedMB must be greater than 0");}