diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 647eb809ed7..bbaed7f502b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -34,6 +34,9 @@ Upgrade Notes * org.apache.solr.search.grouping.distributed.command.QueryCommand.Builder has new method 'setMainQuery' which is used to set top-level query. build() would fail if called without setting mainQuery +* SOLR-13817: Deprecate legacy SolrCache implementations. Users are encouraged to transition their + configurations to use org.apache.solr.search.CaffeineCache instead. + New Features --------------------- diff --git a/solr/core/src/java/org/apache/solr/search/CacheConfig.java b/solr/core/src/java/org/apache/solr/search/CacheConfig.java index 16a9d572568..cbc11914d2b 100644 --- a/solr/core/src/java/org/apache/solr/search/CacheConfig.java +++ b/solr/core/src/java/org/apache/solr/search/CacheConfig.java @@ -124,7 +124,7 @@ public class CacheConfig implements MapSerializable{ SolrResourceLoader loader = solrConfig.getResourceLoader(); config.cacheImpl = config.args.get("class"); - if(config.cacheImpl == null) config.cacheImpl = "solr.LRUCache"; + if (config.cacheImpl == null) config.cacheImpl = "solr.CaffeineCache"; config.regenImpl = config.args.get("regenerator"); config.clazz = loader.findClass(config.cacheImpl, SolrCache.class); if (config.regenImpl != null) { diff --git a/solr/core/src/java/org/apache/solr/search/FastLRUCache.java b/solr/core/src/java/org/apache/solr/search/FastLRUCache.java index c396d478db6..dd88a4a80d4 100644 --- a/solr/core/src/java/org/apache/solr/search/FastLRUCache.java +++ b/solr/core/src/java/org/apache/solr/search/FastLRUCache.java @@ -45,6 +45,8 @@ import org.slf4j.LoggerFactory; * @see org.apache.solr.util.ConcurrentLRUCache * @see org.apache.solr.search.SolrCache * @since solr 1.4 + * @deprecated This cache implementation is deprecated and will be removed in Solr 9.0. + * Use {@link CaffeineCache} instead. */ public class FastLRUCache extends SolrCacheBase implements SolrCache, Accountable { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/java/org/apache/solr/search/LFUCache.java b/solr/core/src/java/org/apache/solr/search/LFUCache.java index 0bb4752e3df..435d24970d2 100644 --- a/solr/core/src/java/org/apache/solr/search/LFUCache.java +++ b/solr/core/src/java/org/apache/solr/search/LFUCache.java @@ -49,6 +49,8 @@ import static org.apache.solr.common.params.CommonParams.NAME; * @see org.apache.solr.util.ConcurrentLFUCache * @see org.apache.solr.search.SolrCache * @since solr 3.6 + * @deprecated This cache implementation is deprecated and will be removed in Solr 9.0. + * Use {@link CaffeineCache} instead. */ public class LFUCache implements SolrCache, Accountable { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/core/src/java/org/apache/solr/search/LRUCache.java b/solr/core/src/java/org/apache/solr/search/LRUCache.java index aee3615de51..41c03807c00 100644 --- a/solr/core/src/java/org/apache/solr/search/LRUCache.java +++ b/solr/core/src/java/org/apache/solr/search/LRUCache.java @@ -43,6 +43,8 @@ import static org.apache.lucene.util.RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_U /** * + * @deprecated This cache implementation is deprecated and will be removed in Solr 9.0. + * Use {@link CaffeineCache} instead. */ public class LRUCache extends SolrCacheBase implements SolrCache, Accountable { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/solr/solr-ref-guide/src/query-settings-in-solrconfig.adoc b/solr/solr-ref-guide/src/query-settings-in-solrconfig.adoc index 8554234de93..e65f41e0d05 100644 --- a/solr/solr-ref-guide/src/query-settings-in-solrconfig.adoc +++ b/solr/solr-ref-guide/src/query-settings-in-solrconfig.adoc @@ -37,6 +37,8 @@ When a new searcher is opened, the current searcher continues servicing requests In Solr, the following cache implementations are available: recommended `solr.search.CaffeineCache`, and legacy implementations: `solr.search.LRUCache`, `solr.search.FastLRUCache,` and `solr.search.LFUCache`. +NOTE: `LRUCache`, `LFUCache` and `FastLRUCache` are deprecated and will be removed in Solr 9.0. Users should switch their configurations to use `CaffeineCache` instead. + The `CaffeineCache` is an implementation backed by the https://github.com/ben-manes/caffeine[Caffeine caching library]. By default it uses a Window TinyLFU (W-TinyLFU) eviction policy, which allows the eviction based on both frequency and recency of use in O(1) time with a small footprint. Generally this cache implementation is recommended over other legacy caches as it usually offers lower memory footprint, higher hit ratio and better multi-threaded performance over legacy caches. The acronym LRU stands for Least Recently Used. When an LRU cache fills up, the entry with the oldest last-accessed timestamp is evicted to make room for the new entry. The net effect is that entries that are accessed frequently tend to stay in the cache, while those that are not accessed frequently tend to drop out and will be re-fetched from the index if needed again.