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 2020/02/04 16:02:26 UTC
[lucene-solr] branch branch_8x updated: SOLR-14239: Fix the
behavior of CaffeineCache.computeIfAbsent on branch_8x.
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 4a00241 SOLR-14239: Fix the behavior of CaffeineCache.computeIfAbsent on branch_8x.
4a00241 is described below
commit 4a002411fcb40a9ac04e59c072e27ac41425119d
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Tue Feb 4 17:02:05 2020 +0100
SOLR-14239: Fix the behavior of CaffeineCache.computeIfAbsent on branch_8x.
---
solr/CHANGES.txt | 2 ++
solr/core/src/java/org/apache/solr/search/CaffeineCache.java | 3 +++
.../src/test-files/solr/configsets/_default/conf/solrconfig.xml | 9 ++++++---
solr/example/example-DIH/solr/db/conf/solrconfig.xml | 9 ++++++---
solr/example/example-DIH/solr/mail/conf/solrconfig.xml | 9 ++++++---
solr/example/example-DIH/solr/solr/conf/solrconfig.xml | 9 ++++++---
solr/example/files/conf/solrconfig.xml | 9 ++++++---
solr/server/solr/configsets/_default/conf/solrconfig.xml | 9 ++++++---
.../configsets/sample_techproducts_configs/conf/solrconfig.xml | 9 ++++++---
9 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1d08477..91e0eb4 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -175,6 +175,8 @@ Bug Fixes
* SOLR-13897: Fix unsafe publication of Terms object in ZkShardTerms that can cause visibility issues
and race conditions under contention. (shalin)
+* SOLR-14239: Fix the behavior of CaffeineCache.computeIfAbsent on branch_8x. (ab)
+
Other Changes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
index f704bb8..c060e9b 100644
--- a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
+++ b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
@@ -181,6 +181,9 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements SolrCache<K, V
return cache.get(key, k -> {
inserts.increment();
V value = mappingFunction.apply(k);
+ if (value == null) {
+ return null;
+ }
ramBytes.add(RamUsageEstimator.sizeOfObject(key, RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_USED) +
RamUsageEstimator.sizeOfObject(value, RamUsageEstimator.QUERY_DEFAULT_RAM_BYTES_USED));
ramBytes.add(RamUsageEstimator.LINKED_HASHTABLE_RAM_BYTES_PER_ENTRY);
diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
index c7fb74a..a061067 100644
--- a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
+++ b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml
@@ -381,9 +381,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/example/example-DIH/solr/db/conf/solrconfig.xml b/solr/example/example-DIH/solr/db/conf/solrconfig.xml
index 34c0e59..84c26ff 100644
--- a/solr/example/example-DIH/solr/db/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/db/conf/solrconfig.xml
@@ -374,9 +374,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml b/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
index 4860a9e..ef293d4 100644
--- a/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/mail/conf/solrconfig.xml
@@ -377,9 +377,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml b/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
index e202d47..42362ef 100644
--- a/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/solr/conf/solrconfig.xml
@@ -374,9 +374,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/example/files/conf/solrconfig.xml b/solr/example/files/conf/solrconfig.xml
index 26bceeb..c28b695 100644
--- a/solr/example/files/conf/solrconfig.xml
+++ b/solr/example/files/conf/solrconfig.xml
@@ -375,9 +375,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/server/solr/configsets/_default/conf/solrconfig.xml b/solr/server/solr/configsets/_default/conf/solrconfig.xml
index c7fb74a..a061067 100644
--- a/solr/server/solr/configsets/_default/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/_default/conf/solrconfig.xml
@@ -381,9 +381,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
index 69cc13d..b28fbe9 100644
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
@@ -407,9 +407,12 @@
<!-- Solr Internal Query Caches
- There are two implementations of cache available for Solr,
- LRUCache, based on a synchronized LinkedHashMap, and
- FastLRUCache, based on a ConcurrentHashMap.
+ There are four implementations of cache available for Solr:
+ LRUCache, based on a synchronized LinkedHashMap,
+ LFUCache and FastLRUCache, based on a ConcurrentHashMap, and CaffeineCache -
+ a modern and robust cache implementation. Note that in Solr 9.0
+ only CaffeineCache will be available, other implementations are now
+ deprecated.
FastLRUCache has faster gets and slower puts in single
threaded operation and thus is generally faster than LRUCache