You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2019/11/14 20:22:47 UTC

[lucene-solr] branch branch_8x updated: SOLR-13817: Deprecate legacy SolrCache implementations.

This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 6e655a9  SOLR-13817: Deprecate legacy SolrCache implementations.
6e655a9 is described below

commit 6e655a99cec2766aa7739d06e586e0e90fd44f10
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Thu Nov 14 18:30:38 2019 +0100

    SOLR-13817: Deprecate legacy SolrCache implementations.
---
 solr/CHANGES.txt                                            | 3 +++
 solr/core/src/java/org/apache/solr/search/CacheConfig.java  | 2 +-
 solr/core/src/java/org/apache/solr/search/FastLRUCache.java | 2 ++
 solr/core/src/java/org/apache/solr/search/LFUCache.java     | 2 ++
 solr/core/src/java/org/apache/solr/search/LRUCache.java     | 2 ++
 solr/solr-ref-guide/src/query-settings-in-solrconfig.adoc   | 2 ++
 6 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 647eb80..bbaed7f 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 16a9d57..cbc1191 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 c396d47..dd88a4a 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<K, V> extends SolrCacheBase implements SolrCache<K, V>, 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 0bb4752..435d249 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<K, V> implements SolrCache<K, V>, 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 aee3615..41c0380 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<K,V> extends SolrCacheBase implements SolrCache<K,V>, 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 8554234..e65f41e 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.