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

Sanjay Dutt commented on SOLR-17148:
------------------------------------

The reason that It worked when updating size to "-1" because in that case 
CaffeineCache failed because of invalid argument.

 
{code:java}
2024-02-03 11:26:19.665 ERROR (coreZkRegister-1-thread-1) [c: s: r: x: t:] 
o.a.s.s.CacheConfig Error instantiating cache => 
java.lang.IllegalArgumentException
        at 
com.github.benmanes.caffeine.cache.Caffeine.requireArgument(Caffeine.java:188)
java.lang.IllegalArgumentException: null
        at 
com.github.benmanes.caffeine.cache.Caffeine.requireArgument(Caffeine.java:188) 
~[?:?]
        at 
com.github.benmanes.caffeine.cache.Caffeine.initialCapacity(Caffeine.java:299) 
~[?:?]
        at 
org.apache.solr.search.CaffeineCache.buildCache(CaffeineCache.java:157) ~[?:?]
        at org.apache.solr.search.CaffeineCache.init(CaffeineCache.java:141) 
~[?:?]
        at org.apache.solr.search.CacheConfig.newInstance(CacheConfig.java:194) 
~[?:?]
        at 
org.apache.solr.search.SolrDocumentFetcher.<init>(SolrDocumentFetcher.java:130) 
~[?:?]{code}
 

Due to the exception, It returns null when requesting for cache object, and in 
this case null for documentCache.
{code:java}
public SolrCache newInstance() {
try {

SolrCache<?, ?> cache = clazz.get().getConstructor().newInstance();
persistence[0] = cache.init(args, persistence[0], regenerator);
System.out.println("No null initialization is needed, all good "+ 
cache.getName()+" "+ clazz.getClass());
return cache;
} catch (Exception e) {
log.error("Error instantiating cache", e);
// we can carry on without a cache... but should we?
// in some cases (like an OOM) we probably should try to continue.
return null;
}
}{code}
 

> Config API lies about setting cache enabled=false
> -------------------------------------------------
>
>                 Key: SOLR-17148
>                 URL: https://issues.apache.org/jira/browse/SOLR-17148
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: config-api
>            Reporter: Chris M. Hostetter
>            Priority: Major
>
> Using the stock solr {{gettingstarted}} example, you can run the command 
> below and it will give all evidence that it has disabled the document cache:
> {noformat}
> curl -X POST 'http://localhost:8983/solr/gettingstarted/config/' 
> -H'Content-type: application/json' -d 
> '{"set-property":{"query.documentCache.enabled":false}}'
> {noformat}
>  * Api command succeeds
>  * {{configoverlay.json}} is updated in ZK
>  * SolrCore reloads happen for all of the replicas of this collection
> ...but doesn't actually disable the cache. It's still there and in use (easy 
> to verify by executing queries and looking at metrics)
> Explicitly stopping & restarting the solr nodes doesn't fix the problem 
> either.
> They {{enabled}} property name appears to be explicitly allowed by the Config 
> API, because trying to set other arbitrary properties fails (even when 
> supported by the {{CaffieneCache}} impl)...
> {noformat}
> $ curl -X POST 'http://localhost:8983/solr/gettingstarted/config/' 
> -H'Content-type: application/json' -d 
> '{"set-property":{"query.documentCache.async":false}}'
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":8},
>   "errorMessages":["error processing commands, errors: 
> [{errorMessages=['query.documentCache.async' is not an editable property], 
> set-property={query.documentCache.async=false}}], \n"],
> {noformat}
> ...suggesting that modifying the {{enabled}} property is intentionally 
> supported – but doesn't work.
>  
> ----
>  
> A quick & dirty workaround is setting the size=-1 and ignoring the ERROR in 
> the logs on every newSearcher...
> {noformat}
> curl -X POST 'http://localhost:8983/solr/gettingstarted/config/' 
> -H'Content-type: application/json' -d 
> '{"set-property":{"query.documentCache.size":-1}}'
> {noformat}
> (Which seems to indicate that whatever the problem is, it's specific to 
> {{enabled}} – and not a general problem with modifying cache configuration 
> via the Config API)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to