deniskuzZ commented on code in PR #5649:
URL: https://github.com/apache/hive/pull/5649#discussion_r2018182045


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/KillTriggerActionHandler.java:
##########
@@ -38,28 +38,24 @@ public class KillTriggerActionHandler implements 
TriggerActionHandler<TezSession
   @Override
   public void applyAction(final Map<TezSessionState, Trigger> queriesViolated) 
{
     for (Map.Entry<TezSessionState, Trigger> entry : 
queriesViolated.entrySet()) {
-      switch (entry.getValue().getAction().getType()) {
-      case KILL_QUERY:
-        TezSessionState sessionState = entry.getKey();
-        String queryId = sessionState.getWmContext().getQueryId();
-        try {
-          UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
-          SessionState ss = new SessionState(new HiveConf(), 
ugi.getShortUserName());
-          ss.setIsHiveServerQuery(true);
-          SessionState.start(ss);
-          KillQuery killQuery = sessionState.getKillQuery();
-          // if kill query is null then session might have been released to 
pool or closed already
-          if (killQuery != null) {
-            sessionState.getKillQuery().killQuery(queryId, 
entry.getValue().getViolationMsg(),
-                      sessionState.getConf());
-          }
-        } catch (HiveException|IOException e) {
-          LOG.warn("Unable to kill query {} for trigger violation", queryId);
+        if (entry.getValue().getAction().getType() == Action.Type.KILL_QUERY) {
+            TezSessionState sessionState = entry.getKey();
+            String queryId = sessionState.getWmContext().getQueryId();
+            try {
+                UserGroupInformation ugi = 
UserGroupInformation.getCurrentUser();
+                DriverUtils.setUpSessionState(sessionState.getConf(), 
ugi.getShortUserName());

Review Comment:
   Before, when we created a new session, we passed a `new HiveConf`, but now 
that might overwrite the current session conf. Note that in `WorkloadManager` 
you are using global conf and not the `TezSessionState`
   IDK, maybe we should fallback to the original `new HiveConf`. It would be 
nice to understand in what Thread both this things are executed and if. 
SessionState exists when we enter there?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to