drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adene...@apache.org
Subject [1/5] drill git commit: DRILL-2650: Mark query end time when closing the Foreman
Date Tue, 15 Sep 2015 12:12:30 GMT
Repository: drill
Updated Branches:
  refs/heads/master e43155d8e -> 0c1b293d9


DRILL-2650: Mark query end time when closing the Foreman

this closes #80


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/e45d0960
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/e45d0960
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/e45d0960

Branch: refs/heads/master
Commit: e45d09603159ecc4cf60c3b1d5f8b54decd55a42
Parents: e43155d
Author: Sudheesh Katkam <skatkam@maprtech.com>
Authored: Wed Jul 22 17:21:50 2015 -0700
Committer: adeneche <adeneche@gmail.com>
Committed: Mon Sep 14 07:59:43 2015 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/work/foreman/Foreman.java | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/e45d0960/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 671deae..2b17933 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
@@ -116,6 +116,7 @@ public class Foreman implements Runnable {
   private static final long RPC_WAIT_IN_MSECS_PER_FRAGMENT = 5000;
 
   private final QueryId queryId;
+  private final String queryIdString;
   private final RunQuery queryRequest;
   private final QueryContext queryContext;
   private final QueryManager queryManager; // handles lower-level details of query execution
@@ -150,6 +151,7 @@ public class Foreman implements Runnable {
       final UserClientConnection connection, final QueryId queryId, final RunQuery queryRequest)
{
     this.bee = bee;
     this.queryId = queryId;
+    queryIdString = QueryIdHelper.getQueryId(queryId);
     this.queryRequest = queryRequest;
     this.drillbitContext = drillbitContext;
 
@@ -221,7 +223,7 @@ public class Foreman implements Runnable {
     // rename the thread we're using for debugging purposes
     final Thread currentThread = Thread.currentThread();
     final String originalName = currentThread.getName();
-    currentThread.setName(QueryIdHelper.getQueryId(queryId) + ":foreman");
+    currentThread.setName(queryIdString + ":foreman");
 
     // track how long the query takes
     queryManager.markStartTime();
@@ -677,7 +679,7 @@ public class Foreman implements Runnable {
     private void logQuerySummary() {
       try {
         LoggedQuery q = new LoggedQuery(
-            QueryIdHelper.getQueryId(queryId),
+            queryIdString,
             queryContext.getQueryContextInfo().getDefaultSchemaName(),
             queryText,
             new Date(queryContext.getQueryContextInfo().getQueryStartTime()),
@@ -695,7 +697,10 @@ public class Foreman implements Runnable {
       Preconditions.checkState(!isClosed);
       Preconditions.checkState(resultState != null);
 
-      logger.info("foreman cleaning up.");
+      // to track how long the query takes
+      queryManager.markEndTime();
+
+      logger.debug(queryIdString + ": cleaning up.");
       injector.injectPause(queryContext.getExecutionControls(), "foreman-cleanup", logger);
 
       // remove the channel disconnected listener (doesn't throw)
@@ -789,7 +794,7 @@ public class Foreman implements Runnable {
       final Exception exception = event.exception;
 
       // TODO Auto-generated method stub
-      logger.info("State change requested.  {} --> {}", state, newState,
+      logger.debug(queryIdString + ": State change requested {} --> {}", state, newState,
           exception);
       switch (state) {
       case PENDING:
@@ -809,7 +814,6 @@ public class Foreman implements Runnable {
         switch (newState) {
         case CANCELLATION_REQUESTED: {
           assert exception == null;
-          queryManager.markEndTime();
           recordNewState(QueryState.CANCELLATION_REQUESTED);
           queryManager.cancelExecutingFragments(drillbitContext);
           foremanResult.setCompleted(QueryState.CANCELED);
@@ -823,7 +827,6 @@ public class Foreman implements Runnable {
 
         case COMPLETED: {
           assert exception == null;
-          queryManager.markEndTime();
           recordNewState(QueryState.COMPLETED);
           foremanResult.setCompleted(QueryState.COMPLETED);
           foremanResult.close();
@@ -832,7 +835,6 @@ public class Foreman implements Runnable {
 
         case FAILED: {
           assert exception != null;
-          queryManager.markEndTime();
           recordNewState(QueryState.FAILED);
           queryManager.cancelExecutingFragments(drillbitContext);
           foremanResult.setFailed(exception);


Mime
View raw message