Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32EA3E92F for ; Mon, 11 Feb 2013 14:41:15 +0000 (UTC) Received: (qmail 94255 invoked by uid 500); 11 Feb 2013 14:41:14 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 93928 invoked by uid 500); 11 Feb 2013 14:41:13 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 93856 invoked by uid 99); 11 Feb 2013 14:41:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2013 14:41:13 +0000 Date: Mon, 11 Feb 2013 14:41:13 +0000 (UTC) From: "Commit Tag Bot (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SOLR-4426) NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB if is not present in solrconfig.xml MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SOLR-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13575814#comment-13575814 ] Commit Tag Bot commented on SOLR-4426: -------------------------------------- [branch_4x commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1444786 SOLR-4426: NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB if is not present in solrconfig.xml > NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB if is not present in solrconfig.xml > ------------------------------------------------------------------------------------------------------------------------------------ > > Key: SOLR-4426 > URL: https://issues.apache.org/jira/browse/SOLR-4426 > Project: Solr > Issue Type: Bug > Components: Schema and Analysis > Affects Versions: 4.1 > Reporter: Jack Krupansky > Assignee: Shalin Shekhar Mangar > Fix For: 4.2, 5.0 > > Attachments: SOLR-4426.patch > > > SolrCore correctly defaults to a NRTCachingDirectoryFactory if no is explicitly specified in solrconfig.xml, but the maxCachedMB and maxMergeSizeMB parameters are not initialized with the same default values as when an explicit directory factory is specified with no argument values given. > Repro: > Remove the explicit directory factory from the Solr 4.1 example solrconfig.xml: > {code} > class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/> > {code} > Start Solr. > In the console output you will see: > {code} > Feb 10, 2013 7:28:55 PM org.apache.solr.core.SolrDeletionPolicy onCommit > INFO: SolrDeletionPolicy.onCommit: commits:num=1 > commit{dir=NRTCachingDirectory(org.apache.lucene.store.SimpleFSDirectory@C:\cygwin\home\projects\solr-4.1.0\solr-4.1.0\example-solrconfig\solr\collection1\data\index lockFactory=org.apache.lucene.store.NativeFSLockFactory@a93430; maxCacheMB=0.0 maxMergeSizeMB=0.0),segFN=segments_1,generation=1,filenames=[segments_1] > F{code} > Note the "maxCacheMB=0.0" and "maxMergeSizeMB=0.0". These should be defaulting to values of 48.0 and 4.0, respectively. > In SolrCore.java we have: > {code} > private void initDirectoryFactory() { > DirectoryFactory dirFactory; > PluginInfo info = solrConfig.getPluginInfo(DirectoryFactory.class.getName()); > if (info != null) { > log.info(info.className); > dirFactory = getResourceLoader().newInstance(info.className, DirectoryFactory.class); > dirFactory.init(info.initArgs); > } else { > log.info("solr.NRTCachingDirectoryFactory"); > dirFactory = new NRTCachingDirectoryFactory(); > } > // And set it > directoryFactory = dirFactory; > } > {code} > The difference between an explicit directory factory with no arguments and the implicit directory factory default is that the "init" method is not called for the latter. It is only in the init method that the default values are set. > I suggest changing NRTCachingDirectoryFactory.java from: > {code} > public class NRTCachingDirectoryFactory extends StandardDirectoryFactory { > private double maxMergeSizeMB; > private double maxCachedMB; > @Override > public void init(NamedList args) { > super.init(args); > SolrParams params = SolrParams.toSolrParams(args); > maxMergeSizeMB = params.getDouble("maxMergeSizeMB", 4); > if (maxMergeSizeMB <= 0){ > throw new IllegalArgumentException("maxMergeSizeMB must be greater than 0"); > } > maxCachedMB = params.getDouble("maxCachedMB", 48); > if (maxCachedMB <= 0){ > throw new IllegalArgumentException("maxCachedMB must be greater than 0"); > } > } > {code} > to: > {code} > public class NRTCachingDirectoryFactory extends StandardDirectoryFactory { > 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; > @Override > public void init(NamedList args) { > super.init(args); > SolrParams params = SolrParams.toSolrParams(args); > 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", DEFAULT_MAX_CACHED_MB); > if (maxCachedMB <= 0){ > throw new IllegalArgumentException("maxCachedMB must be greater than 0"); > } > } > {code} > Note: This issue is not present in Solr 4.0 since the two parameters were hardwired in the NRTCachingDirectoryFactory.create method. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org