[
https://issues.apache.org/jira/browse/SOLR-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13575807#comment-13575807
]
Commit Tag Bot commented on SOLR-4426:
--------------------------------------
[trunk commit] Shalin Shekhar Mangar
http://svn.apache.org/viewvc?view=revision&revision=1444782
SOLR-4426: NRTCachingDirectoryFactory does not initialize maxCachedMB and
maxMergeSizeMB if <directoryFactory> is not present in solrconfig.xml
> NRTCachingDirectoryFactory does not initialize maxCachedMB and maxMergeSizeMB
> if <directoryFactory> 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
> Attachments: SOLR-4426.patch
>
>
> SolrCore correctly defaults to a NRTCachingDirectoryFactory if no
> <cirectoryFactory> 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}
> <directoryFactory name="DirectoryFactory"
>
> 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: [email protected]
For additional commands, e-mail: [email protected]