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

dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new 6fe8b0c5f1 Modified SessionManager to recognize session idle property 
updates (#5239)
6fe8b0c5f1 is described below

commit 6fe8b0c5f1f0b0821524f6c20a283e1d6d37308f
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Thu Jan 9 14:13:01 2025 -0500

    Modified SessionManager to recognize session idle property updates (#5239)
    
    Reverted changes in #4780, which marked the properties as not mutable.
    Passed the ServerContext to the sweep method instead of the property
    values. The property values are resolved at sweep method execution
    time.
    
    Closes #4723
---
 .../java/org/apache/accumulo/core/conf/Property.java   |  3 +--
 .../accumulo/tserver/session/SessionManager.java       | 18 +++++++-----------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java 
b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 981799f6d0..942dfeea45 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -1898,8 +1898,7 @@ public enum Property {
       COMPACTOR_MINTHREADS_TIMEOUT,
 
       // others
-      TSERV_NATIVEMAP_ENABLED, TSERV_SCAN_MAX_OPENFILES, 
MANAGER_RECOVERY_WAL_EXISTENCE_CACHE_TIME,
-      TSERV_SESSION_MAXIDLE, TSERV_UPDATE_SESSION_MAXIDLE);
+      TSERV_NATIVEMAP_ENABLED, TSERV_SCAN_MAX_OPENFILES, 
MANAGER_RECOVERY_WAL_EXISTENCE_CACHE_TIME);
 
   /**
    * Checks if the given property may be changed via Zookeeper, but not 
recognized until the restart
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java
index d1bf4d6f8c..0726c1997c 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java
@@ -70,22 +70,15 @@ public class SessionManager {
 
   private static final SecureRandom random = new SecureRandom();
   private final ConcurrentMap<Long,Session> sessions = new 
ConcurrentHashMap<>();
-  private final long maxIdle;
-  private final long maxUpdateIdle;
   private final BlockingQueue<Session> deferredCleanupQueue = new 
ArrayBlockingQueue<>(5000);
   private final Long expiredSessionMarker = (long) -1;
-  private final AccumuloConfiguration aconf;
   private final ServerContext ctx;
   private volatile LongConsumer zombieCountConsumer = null;
 
   public SessionManager(ServerContext context) {
     this.ctx = context;
-    this.aconf = context.getConfiguration();
-    maxUpdateIdle = 
aconf.getTimeInMillis(Property.TSERV_UPDATE_SESSION_MAXIDLE);
-    maxIdle = aconf.getTimeInMillis(Property.TSERV_SESSION_MAXIDLE);
-
-    Runnable r = () -> sweep(maxIdle, maxUpdateIdle);
-
+    long maxIdle = 
ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE);
+    Runnable r = () -> sweep(ctx);
     
ThreadPools.watchCriticalScheduledTask(context.getScheduledExecutor().scheduleWithFixedDelay(r,
         0, Math.max(maxIdle / 2, 1000), TimeUnit.MILLISECONDS));
   }
@@ -107,7 +100,7 @@ public class SessionManager {
   }
 
   public long getMaxIdleTime() {
-    return maxIdle;
+    return 
ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE);
   }
 
   /**
@@ -309,7 +302,10 @@ public class SessionManager {
     cleanup(deferredCleanupQueue, session);
   }
 
-  private void sweep(final long maxIdle, final long maxUpdateIdle) {
+  private void sweep(final ServerContext context) {
+    final AccumuloConfiguration conf = context.getConfiguration();
+    final long maxUpdateIdle = 
conf.getTimeInMillis(Property.TSERV_UPDATE_SESSION_MAXIDLE);
+    final long maxIdle = conf.getTimeInMillis(Property.TSERV_SESSION_MAXIDLE);
     List<Session> sessionsToCleanup = new LinkedList<>();
     Iterator<Session> iter = sessions.values().iterator();
     while (iter.hasNext()) {

Reply via email to