DRILL-5859: Fixed queued time calculation closes #982
Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/cf3a5eef Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/cf3a5eef Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/cf3a5eef Branch: refs/heads/master Commit: cf3a5eef23ffe0cdc33366941e60cee4e593f684 Parents: e14cb7a Author: Prasad Nagaraj Subramanya <prasadn...@gmail.com> Authored: Tue Oct 10 11:12:03 2017 -0700 Committer: Paul Rogers <prog...@maprtech.com> Committed: Wed Oct 11 10:25:20 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/drill/exec/work/foreman/Foreman.java | 3 ++- .../drill/exec/work/foreman/rm/DistributedQueryQueue.java | 9 +++++---- .../org/apache/drill/exec/work/foreman/rm/QueryQueue.java | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/cf3a5eef/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java index a1f9d9f..10d8537 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java @@ -455,9 +455,10 @@ public class Foreman implements Runnable { .build(logger); } catch (QueryQueueException e) { throw new ForemanSetupException(e.getMessage(), e); + } finally { + queryManager.markQueueWaitEndTime(); } moveToState(QueryState.STARTING, null); - queryManager.markQueueWaitEndTime(); } /** http://git-wip-us.apache.org/repos/asf/drill/blob/cf3a5eef/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/DistributedQueryQueue.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/DistributedQueryQueue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/DistributedQueryQueue.java index 9a4c78d..f4c5536 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/DistributedQueryQueue.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/DistributedQueryQueue.java @@ -140,7 +140,7 @@ public class DistributedQueryQueue implements QueryQueue { private static class ConfigSet { private final long queueThreshold; - private final long queueTimeout; + private final int queueTimeout; private final int largeQueueSize; private final int smallQueueSize; private final double largeToSmallRatio; @@ -149,7 +149,7 @@ public class DistributedQueryQueue implements QueryQueue { public ConfigSet(SystemOptionManager optionManager) { queueThreshold = optionManager.getOption(ExecConstants.QUEUE_THRESHOLD_SIZE); - queueTimeout = optionManager.getOption(ExecConstants.QUEUE_TIMEOUT); + queueTimeout = (int) optionManager.getOption(ExecConstants.QUEUE_TIMEOUT); // Option manager supports only long values, but we do not expect // more than 2 billion active queries, so queue size is stored as @@ -274,8 +274,9 @@ public class DistributedQueryQueue implements QueryQueue { if (lease == null) { int timeoutSecs = (int) Math.round(configSet.queueTimeout/1000.0); - logger.warn("Queue timeout: {} after {} seconds.", queueName, timeoutSecs); - throw new QueueTimeoutException(queryId, queueName, timeoutSecs); + logger.warn("Queue timeout: {} after {} ms. ({} seconds)", queueName, + String.format("%,d", configSet.queueTimeout), timeoutSecs); + throw new QueueTimeoutException(queryId, queueName, configSet.queueTimeout); } return new DistributedQueueLease(queryId, queueName, lease, queryMemory); } http://git-wip-us.apache.org/repos/asf/drill/blob/cf3a5eef/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/QueryQueue.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/QueryQueue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/QueryQueue.java index 72dc2d6..67a8b96 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/QueryQueue.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/QueryQueue.java @@ -65,8 +65,8 @@ public interface QueryQueue { public QueueTimeoutException(QueryId queryId, String queueName, int timeoutMs) { super( String.format( - "Query timed out of the %s queue after %d ms.", - queueName, timeoutMs )); + "Query timed out of the %s queue after %,d ms. (%d seconds)", + queueName, timeoutMs, (int) Math.round(timeoutMs/1000.0) )); this.queryId = queryId; this.queueName = queueName; this.timeoutMs = timeoutMs;