From f1fd994b52cffaa9c5f50b65ee29b9062ef4033f Mon Sep 17 00:00:00 2001 From: Dave Marion Date: Thu, 8 Oct 2026 15:32:23 +0000 Subject: [PATCH] Made Property TSERV_SCAN_RESULTS_MAX_TIMEOUT responsive to change Removed TSERV_SCAN_RESULTS_MAX_TIMEOUT from the fixed property set and changed the locations that use it to re-check the property value at 10 second intervals. --- .../apache/accumulo/core/conf/Property.java | 19 ++++++++--------- .../accumulo/tserver/TabletClientHandler.java | 16 +++++++++----- .../tserver/ThriftScanClientHandler.java | 21 ++++++++++++------- 3 files changed, 34 insertions(+), 22 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 7e039e74f03..e3820285619 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 @@ -2065,16 +2065,15 @@ public static boolean isValidTablePropertyKey(String key) { TSERV_WALOG_TOLERATED_CREATION_FAILURES, TSERV_WAL_TOLERATED_WAIT_INCREMENT, TSERV_WALOG_TOLERATED_WAIT_INCREMENT, TSERV_WAL_TOLERATED_MAXIMUM_WAIT_DURATION, TSERV_WALOG_TOLERATED_MAXIMUM_WAIT_DURATION, TSERV_MAX_IDLE, TSERV_SESSION_MAXIDLE, - TSERV_SCAN_RESULTS_MAX_TIMEOUT, TSERV_MAJC_DELAY, TSERV_COMPACTION_SERVICE_DEFAULT_MAX_OPEN, - TSERV_MAJC_THREAD_MAXOPEN, TSERV_MAJC_MAXCONCURRENT, TSERV_MAJC_THROUGHPUT, - TSERV_MINC_MAXCONCURRENT, TSERV_MONITOR_FS, TSERV_HEALTH_CHECK_FREQ, TSERV_THREADCHECK, - TSERV_LOG_BUSY_TABLETS_COUNT, TSERV_LOG_BUSY_TABLETS_INTERVAL, TSERV_WAL_SORT_MAX_CONCURRENT, - TSERV_RECOVERY_MAX_CONCURRENT, TSERV_WORKQ_THREADS, TSERV_SLOW_FILEPERMIT_MILLIS, - TSERV_READ_AHEAD_MAXCONCURRENT, TSERV_METADATA_READ_AHEAD_MAXCONCURRENT, TSERV_WAL_BLOCKSIZE, - TSERV_CLIENTPORT, TSERV_PORTSEARCH, TSERV_MAX_MESSAGE_SIZE, TSERV_CACHE_MANAGER_IMPL, - TSERV_DATACACHE_SIZE, TSERV_INDEXCACHE_SIZE, TSERV_SUMMARYCACHE_SIZE, TSERV_DEFAULT_BLOCKSIZE, - TSERV_MINTHREADS, TSERV_MINTHREADS_TIMEOUT, TSERV_NATIVEMAP_ENABLED, TSERV_MAXMEM, - TSERV_SCAN_MAX_OPENFILES, + TSERV_MAJC_DELAY, TSERV_COMPACTION_SERVICE_DEFAULT_MAX_OPEN, TSERV_MAJC_THREAD_MAXOPEN, + TSERV_MAJC_MAXCONCURRENT, TSERV_MAJC_THROUGHPUT, TSERV_MINC_MAXCONCURRENT, TSERV_MONITOR_FS, + TSERV_HEALTH_CHECK_FREQ, TSERV_THREADCHECK, TSERV_LOG_BUSY_TABLETS_COUNT, + TSERV_LOG_BUSY_TABLETS_INTERVAL, TSERV_WAL_SORT_MAX_CONCURRENT, TSERV_RECOVERY_MAX_CONCURRENT, + TSERV_WORKQ_THREADS, TSERV_SLOW_FILEPERMIT_MILLIS, TSERV_READ_AHEAD_MAXCONCURRENT, + TSERV_METADATA_READ_AHEAD_MAXCONCURRENT, TSERV_WAL_BLOCKSIZE, TSERV_CLIENTPORT, + TSERV_PORTSEARCH, TSERV_MAX_MESSAGE_SIZE, TSERV_CACHE_MANAGER_IMPL, TSERV_DATACACHE_SIZE, + TSERV_INDEXCACHE_SIZE, TSERV_SUMMARYCACHE_SIZE, TSERV_DEFAULT_BLOCKSIZE, TSERV_MINTHREADS, + TSERV_MINTHREADS_TIMEOUT, TSERV_NATIVEMAP_ENABLED, TSERV_MAXMEM, TSERV_SCAN_MAX_OPENFILES, // GC options GC_CANDIDATE_BATCH_SIZE, GC_CYCLE_START, GC_PORT, diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java index 3176e45c08c..eac87f25f3d 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.time.Duration; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -131,6 +132,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; import com.google.common.cache.Cache; import io.opentelemetry.api.trace.Span; @@ -139,7 +142,7 @@ public class TabletClientHandler implements TabletClientService.Iface { private static final Logger log = LoggerFactory.getLogger(TabletClientHandler.class); - private final long MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS; + private final Supplier scanResultWaitTime; private static final long RECENTLY_SPLIT_MILLIES = MINUTES.toMillis(1); private final TabletServer server; protected final TransactionWatcher watcher; @@ -155,8 +158,12 @@ public TabletClientHandler(TabletServer server, TransactionWatcher watcher, this.writeTracker = writeTracker; this.security = context.getSecurityOperation(); this.server = server; - MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS = server.getContext().getConfiguration() - .getTimeInMillis(Property.TSERV_SCAN_RESULTS_MAX_TIMEOUT); + scanResultWaitTime = + Suppliers + .memoizeWithExpiration( + () -> server.getContext().getConfiguration() + .getTimeInMillis(Property.TSERV_SCAN_RESULTS_MAX_TIMEOUT), + Duration.ofSeconds(10)); log.debug("{} created", TabletClientHandler.class.getName()); } @@ -1534,8 +1541,7 @@ public void removeLogs(TInfo tinfo, TCredentials credentials, List filen private TSummaries getSummaries(Future future) throws TimeoutException { try { - SummaryCollection sc = - future.get(MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS, TimeUnit.MILLISECONDS); + SummaryCollection sc = future.get(scanResultWaitTime.get(), TimeUnit.MILLISECONDS); return sc.toThrift(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftScanClientHandler.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftScanClientHandler.java index 1b3284036ba..0667e9c13a8 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftScanClientHandler.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftScanClientHandler.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.time.Duration; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -88,6 +89,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; import com.google.common.collect.Collections2; public class ThriftScanClientHandler implements TabletScanClientService.Iface { @@ -98,15 +101,19 @@ public class ThriftScanClientHandler implements TabletScanClientService.Iface { protected final ServerContext context; protected final AuditedSecurityOperation security; private final WriteTracker writeTracker; - private final long MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS; + private final Supplier scanResultWaitTime; public ThriftScanClientHandler(TabletHostingServer server, WriteTracker writeTracker) { this.server = server; this.context = server.getContext(); this.writeTracker = writeTracker; this.security = context.getSecurityOperation(); - MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS = server.getContext().getConfiguration() - .getTimeInMillis(Property.TSERV_SCAN_RESULTS_MAX_TIMEOUT); + scanResultWaitTime = + Suppliers + .memoizeWithExpiration( + () -> server.getContext().getConfiguration() + .getTimeInMillis(Property.TSERV_SCAN_RESULTS_MAX_TIMEOUT), + Duration.ofSeconds(10)); } public NamespaceId getNamespaceId(TCredentials credentials, TableId tableId) @@ -264,7 +271,7 @@ protected ScanResult continueScan(TInfo tinfo, long scanID, SingleScanSession sc ScanBatch bresult; try { - bresult = scanSession.getScanTask().get(busyTimeout, MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS, + bresult = scanSession.getScanTask().get(busyTimeout, scanResultWaitTime.get(), TimeUnit.MILLISECONDS); scanSession.clearScanTask(); } catch (ExecutionException e) { @@ -277,7 +284,7 @@ protected ScanResult continueScan(TInfo tinfo, long scanID, SingleScanSession sc } else if (e.getCause() instanceof SampleNotPresentException) { throw new TSampleNotPresentException(scanSession.extent.toThrift()); } else if (e.getCause() instanceof IOException) { - sleepUninterruptibly(MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS, TimeUnit.MILLISECONDS); + sleepUninterruptibly(scanResultWaitTime.get(), TimeUnit.MILLISECONDS); List empty = Collections.emptyList(); bresult = new ScanBatch(empty, true); scanSession.clearScanTask(); @@ -482,8 +489,8 @@ private MultiScanResult continueMultiScan(long scanID, MultiScanSession session, try { - MultiScanResult scanResult = session.getScanTask().get(busyTimeout, - MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS, TimeUnit.MILLISECONDS); + MultiScanResult scanResult = + session.getScanTask().get(busyTimeout, scanResultWaitTime.get(), TimeUnit.MILLISECONDS); session.clearScanTask(); return scanResult; } catch (ExecutionException e) {