You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ed...@apache.org on 2019/06/13 15:55:53 UTC
[accumulo] branch 1.9 updated: fixed time calculation to use nano
delta (#1184)
This is an automated email from the ASF dual-hosted git repository.
edcoleman pushed a commit to branch 1.9
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/1.9 by this push:
new 246db1a fixed time calculation to use nano delta (#1184)
246db1a is described below
commit 246db1a3fd6c8d9a26c57b04ed5d8532bc742dc5
Author: EdColeman <de...@etcoleman.com>
AuthorDate: Thu Jun 13 11:55:48 2019 -0400
fixed time calculation to use nano delta (#1184)
* fixed time calculation to use nano delta
* changed the nanoTime usage in this file to be consistent
---
.../java/org/apache/accumulo/tserver/tablet/Tablet.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 3366e9e..d3ff86c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -581,7 +581,9 @@ public class Tablet implements TabletCommitter {
if (columnSet.size() > 0)
cfset = LocalityGroupUtil.families(columnSet);
- long returnTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(batchTimeOut);
+ long timeToRun = TimeUnit.MILLISECONDS.toNanos(batchTimeOut);
+ long startNanos = System.nanoTime();
+
if (batchTimeOut <= 0 || batchTimeOut == Long.MAX_VALUE) {
batchTimeOut = 0;
}
@@ -594,7 +596,7 @@ public class Tablet implements TabletCommitter {
for (Range range : ranges) {
- boolean timesUp = batchTimeOut > 0 && System.nanoTime() > returnTime;
+ boolean timesUp = batchTimeOut > 0 && (System.nanoTime() - startNanos) > timeToRun;
if (exceededMemoryUsage || tabletClosed || timesUp || yielded) {
lookupResult.unfinishedRanges.add(range);
@@ -624,7 +626,7 @@ public class Tablet implements TabletCommitter {
exceededMemoryUsage = lookupResult.bytesAdded > maxResultsSize;
- timesUp = batchTimeOut > 0 && System.nanoTime() > returnTime;
+ timesUp = batchTimeOut > 0 && (System.nanoTime() - startNanos) > timeToRun;
if (exceededMemoryUsage || timesUp) {
addUnfinishedRange(lookupResult, range, key, false);
@@ -783,7 +785,9 @@ public class Tablet implements TabletCommitter {
// log.info("In nextBatch..");
- long stopTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(batchTimeOut);
+ long timeToRun = TimeUnit.MILLISECONDS.toNanos(batchTimeOut);
+ long startNanos = System.nanoTime();
+
if (batchTimeOut == Long.MAX_VALUE || batchTimeOut <= 0) {
batchTimeOut = 0;
}
@@ -826,7 +830,7 @@ public class Tablet implements TabletCommitter {
resultSize += kvEntry.estimateMemoryUsed();
resultBytes += kvEntry.numBytes();
- boolean timesUp = batchTimeOut > 0 && System.nanoTime() >= stopTime;
+ boolean timesUp = batchTimeOut > 0 && (System.nanoTime() - startNanos) >= timeToRun;
if (resultSize >= maxResultsSize || results.size() >= num || timesUp) {
continueKey = new Key(key);