You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/02/24 01:08:39 UTC

[07/50] [abbrv] hive git commit: HIVE-15936: ConcurrentModificationException in ATSHook (Daniel Dai, reviewed by Jason Dere)

HIVE-15936: ConcurrentModificationException in ATSHook (Daniel Dai, reviewed by Jason Dere)


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

Branch: refs/heads/hive-14535
Commit: 3485d02cbfca5603e86e7b370da86b607003f337
Parents: 90688bd
Author: Daniel Dai <da...@hortonworks.com>
Authored: Fri Feb 17 00:22:54 2017 -0800
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Fri Feb 17 00:22:54 2017 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/hooks/ATSHook.java     | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/3485d02c/ql/src/java/org/apache/hadoop/hive/ql/hooks/ATSHook.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/ATSHook.java b/ql/src/java/org/apache/hadoop/hive/ql/hooks/ATSHook.java
index 55b922b..72a1acc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/ATSHook.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/ATSHook.java
@@ -143,6 +143,11 @@ public class ATSHook implements ExecuteWithHookContext {
     final QueryState queryState = hookContext.getQueryState();
     final String queryId = queryState.getQueryId();
 
+    final Map<String, Long> durations = new HashMap<String, Long>();
+    for (String key : hookContext.getPerfLogger().getEndTimes().keySet()) {
+      durations.put(key, hookContext.getPerfLogger().getDuration(key));
+    }
+
     try {
       setupAtsExecutor(conf);
 
@@ -203,10 +208,10 @@ public class ATSHook implements ExecuteWithHookContext {
                         tablesRead, tablesWritten, conf, llapId));
                 break;
               case POST_EXEC_HOOK:
-                fireAndForget(createPostHookEvent(queryId, currentTime, user, requestuser, true, opId, hookContext.getPerfLogger()));
+                fireAndForget(createPostHookEvent(queryId, currentTime, user, requestuser, true, opId, durations));
                 break;
               case ON_FAILURE_HOOK:
-                fireAndForget(createPostHookEvent(queryId, currentTime, user, requestuser , false, opId, hookContext.getPerfLogger()));
+                fireAndForget(createPostHookEvent(queryId, currentTime, user, requestuser , false, opId, durations));
                 break;
               default:
                 //ignore
@@ -325,7 +330,7 @@ public class ATSHook implements ExecuteWithHookContext {
   }
 
   TimelineEntity createPostHookEvent(String queryId, long stopTime, String user, String requestuser, boolean success,
-      String opId, PerfLogger perfLogger) throws Exception {
+      String opId, Map<String, Long> durations) throws Exception {
     LOG.info("Received post-hook notification for :" + queryId);
 
     TimelineEntity atsEntity = new TimelineEntity();
@@ -346,8 +351,8 @@ public class ATSHook implements ExecuteWithHookContext {
 
     // Perf times
     JSONObject perfObj = new JSONObject(new LinkedHashMap<>());
-    for (String key : perfLogger.getEndTimes().keySet()) {
-      perfObj.put(key, perfLogger.getDuration(key));
+    for (Map.Entry<String, Long> entry : durations.entrySet()) {
+      perfObj.put(entry.getKey(), entry.getValue());
     }
     atsEntity.addOtherInfo(OtherInfoTypes.PERF.name(), perfObj.toString());