[ 
https://issues.apache.org/jira/browse/SOLR-11688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267911#comment-16267911
 ] 

Erick Erickson commented on SOLR-11688:
---------------------------------------

I was thinking about this a little more and there is at least one nuance. The 
default transient cache handler is, well, the default. So a user can freely 
create a core with transient=true. What should happen in that case if no 
explicit transientCacheHandler has been defined?

Proposal: We simply treat it as a "normal" core. By that I mean pretend 
transient=false. This is pretty much the current behavior since the limit on 
transient cores is Integer.MAX_VALUE.

Or maybe initialize the LinkedHashMap with a much smaller value (say 10). It'll 
still grow without limit if it's not configured, but likely that'll introduce 
fewer failure cases, everywhere we currently use transientCacheHandler we'd 
need to test for null.....

> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to