You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Varun Thacker (JIRA)" <ji...@apache.org> on 2017/11/27 23:14:00 UTC

[jira] [Created] (SOLR-11688) Transient cache should not get initiated unless explicitly configured

Varun Thacker created SOLR-11688:
------------------------------------

             Summary: Transient cache should not get initiated unless explicitly configured
                 Key: SOLR-11688
                 URL: https://issues.apache.org/jira/browse/SOLR-11688
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Varun Thacker


When I start solr using the default configset and solr.xml ( which doesn't have any transient cache enabled ) I see this line entry

{code}
INFO  - 2017-11-27 21:55:10.190; [   ] org.apache.solr.core.TransientSolrCoreCacheDefault; Allocating transient cache for 2147483647 transient cores
{code}

This line kind of looked scary so I spoke to Erick offline and we could do two things here:

1. Not initialize a transient cache if not configured . Today we are configuring a 1000 entry cache based on this code path

{code}
log.info("Allocating transient cache for {} transient cores", cacheSize);
    addObserver(this.observer);
    // it's possible for cache
    if (cacheSize < 0) { // Trap old flag
      cacheSize = Integer.MAX_VALUE;
    }
    // Now don't allow ridiculous allocations here, if the size is > 1,000, we'll just deal with
    // adding cores as they're opened. This blows up with the marker value of -1.
    transientCores = new LinkedHashMap<String, SolrCore>(Math.min(cacheSize, 1000), 0.75f, true) {
      @Override
      protected boolean removeEldestEntry(Map.Entry<String, SolrCore> eldest) {
        if (size() > cacheSize) {
          SolrCore coreToClose = eldest.getValue();
          setChanged();
          notifyObservers(coreToClose);
          log.info("Closing transient core [{}]", coreToClose.getName());
          return true;
        }
        return false;
      }
    };
{code}


2. "Allocating transient cache for 2147483647 transient cores" means we are creating a cache that large while we aren't in reality. So a better message for this line



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org