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

cshannon 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 38952c9226 Update TabletServerBatchReaderIterator to use nanotime 
(#4864)
38952c9226 is described below

commit 38952c922648014e74e4e7a5704bfa256f390faa
Author: Christopher L. Shannon <cshan...@apache.org>
AuthorDate: Sat Sep 7 14:26:51 2024 -0400

    Update TabletServerBatchReaderIterator to use nanotime (#4864)
    
    The iterator now uses a Timer for tracking elapsed time which is based
    on nano time instead of System millis
    
    This closes #4804
---
 .../accumulo/core/clientImpl/TabletServerBatchReaderIterator.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
index a852531bc6..f43f571f6c 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
@@ -504,7 +504,7 @@ public class TabletServerBatchReaderIterator implements 
Iterator<Entry<Key,Value
 
   private void doLookups(Map<String,Map<KeyExtent,List<Range>>> binnedRanges,
       final ResultReceiver receiver, List<Column> columns) {
-    long startTime = System.currentTimeMillis();
+    Timer startTime = Timer.startNew();
     int maxTabletsPerRequest = Integer.MAX_VALUE;
 
     long busyTimeout = 0;
@@ -606,7 +606,7 @@ public class TabletServerBatchReaderIterator implements 
Iterator<Entry<Key,Value
   }
 
   private ScanServerData 
rebinToScanServers(Map<String,Map<KeyExtent,List<Range>>> binnedRanges,
-      long startTime) {
+      Timer startTime) {
     ScanServerSelector ecsm = context.getScanServerSelector();
 
     List<TabletIdImpl> tabletIds =
@@ -616,8 +616,7 @@ public class TabletServerBatchReaderIterator implements 
Iterator<Entry<Key,Value
     // get a snapshot of this once,not each time the plugin request it
     var scanAttemptsSnapshot = scanAttempts.snapshot();
 
-    Duration timeoutLeft = Duration.ofMillis(retryTimeout)
-        .minus(Duration.ofMillis(System.currentTimeMillis() - startTime));
+    Duration timeoutLeft = Duration.ofMillis(retryTimeout - 
startTime.elapsed(MILLISECONDS));
 
     ScanServerSelector.SelectorParameters params = new 
ScanServerSelector.SelectorParameters() {
       @Override

Reply via email to