You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sa...@apache.org on 2021/03/23 10:06:06 UTC

[cassandra] branch trunk updated: Restore async refresh executor to auth caches

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

samt pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d656f8a  Restore async refresh executor to auth caches
d656f8a is described below

commit d656f8ac012f4577d22ed7bd3db94c15ae8eb5a9
Author: Sam Tunnicliffe <sa...@beobal.com>
AuthorDate: Fri Mar 19 11:30:57 2021 +0000

    Restore async refresh executor to auth caches
    
    Patch by Sam Tunnicliffe; reviewed by Brandon Williams and Benjamin
    Lerer for CASSANDRA-15177
---
 CHANGES.txt                                       | 1 +
 src/java/org/apache/cassandra/auth/AuthCache.java | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 90eac99..bb9bd81 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0-beta5
+ * Execute background refreshing of auth caches on a dedicated executor (CASSANDRA-15177)
  * Update bundled java and python drivers to 3.11.0 and 3.25.0 respectively (CASSANDRA-13951)
  * Add io.netty.tryReflectionSetAccessible=true to j11 server options in order to enable netty to use Unsafe direct byte buffer construction (CASSANDRA-16493)
  * Make cassandra-stress -node support host:port notation (CASSANDRA-16529)
diff --git a/src/java/org/apache/cassandra/auth/AuthCache.java b/src/java/org/apache/cassandra/auth/AuthCache.java
index 4bf15c1..6393da7 100644
--- a/src/java/org/apache/cassandra/auth/AuthCache.java
+++ b/src/java/org/apache/cassandra/auth/AuthCache.java
@@ -24,12 +24,12 @@ import java.util.function.Function;
 import java.util.function.IntConsumer;
 import java.util.function.IntSupplier;
 
-import com.google.common.util.concurrent.MoreExecutors;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.github.benmanes.caffeine.cache.Caffeine;
 import com.github.benmanes.caffeine.cache.LoadingCache;
+import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor;
 import org.apache.cassandra.utils.MBeanWrapper;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -44,6 +44,7 @@ public class AuthCache<K, V> implements AuthCacheMBean
      * Underlying cache. LoadingCache will call underlying load function on {@link #get} if key is not present
      */
     protected volatile LoadingCache<K, V> cache;
+    private DebuggableThreadPoolExecutor cacheRefreshExecutor;
 
     private String name;
     private IntConsumer setValidityDelegate;
@@ -93,6 +94,7 @@ public class AuthCache<K, V> implements AuthCacheMBean
      */
     protected void init()
     {
+        this.cacheRefreshExecutor = new DebuggableThreadPoolExecutor(name + "Refresh", Thread.NORM_PRIORITY);
         cache = initCache(null);
         MBeanWrapper.instance.registerMBean(this, getObjectName());
     }
@@ -218,7 +220,7 @@ public class AuthCache<K, V> implements AuthCacheMBean
                          .refreshAfterWrite(getUpdateInterval(), TimeUnit.MILLISECONDS)
                          .expireAfterWrite(getValidity(), TimeUnit.MILLISECONDS)
                          .maximumSize(getMaxEntries())
-                         .executor(MoreExecutors.directExecutor())
+                         .executor(cacheRefreshExecutor)
                          .build(loadFunction::apply);
         }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org