Skip to content

Commit

Permalink
Merge branch '3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmarion committed Jan 9, 2025
2 parents a3253f4 + e347e8b commit 09dc3ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1478,8 +1478,7 @@ public static boolean isValidTablePropertyKey(String key) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,14 @@ public class SessionManager {
private static final Logger log = LoggerFactory.getLogger(SessionManager.class);

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 ServerContext ctx;
private volatile LongConsumer zombieCountConsumer = null;

public SessionManager(ServerContext context) {
this.ctx = context;
final AccumuloConfiguration 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), MILLISECONDS));
}
Expand All @@ -98,7 +92,7 @@ public long createSession(Session session, boolean reserve) {
}

public long getMaxIdleTime() {
return maxIdle;
return ctx.getConfiguration().getTimeInMillis(Property.TSERV_SESSION_MAXIDLE);
}

/**
Expand Down Expand Up @@ -294,7 +288,10 @@ private void cleanup(Session session) {
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()) {
Expand Down

0 comments on commit 09dc3ce

Please sign in to comment.