This is an automated email from the ASF dual-hosted git repository.

kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ba52637  HIVE-23003: CliDriver leaves the session id in the threadname 
on failure (Zoltan Haindrich reviewed by Miklos Gergely)
ba52637 is described below

commit ba52637e41ca3a5e5952d92ecd27bf8cb69411ca
Author: Zoltan Haindrich <k...@rxd.hu>
AuthorDate: Wed Mar 11 13:12:48 2020 +0000

    HIVE-23003: CliDriver leaves the session id in the threadname on failure 
(Zoltan Haindrich reviewed by Miklos Gergely)
    
    Signed-off-by: Zoltan Haindrich <k...@rxd.hu>
---
 cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java 
b/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
index cdd08ce..cfea602 100644
--- a/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
+++ b/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
@@ -120,11 +120,19 @@ public class CliDriver {
   public CommandProcessorResponse processCmd(String cmd) throws 
CommandProcessorException {
     CliSessionState ss = (CliSessionState) SessionState.get();
     ss.setLastCommand(cmd);
-
-    ss.updateThreadName();
-
     // Flush the print stream, so it doesn't include output from the last 
command
     ss.err.flush();
+    try {
+      ss.updateThreadName();
+      return processCmd1(cmd);
+    } finally {
+      ss.resetThreadName();
+    }
+  }
+
+  public CommandProcessorResponse processCmd1(String cmd) throws 
CommandProcessorException {
+    CliSessionState ss = (CliSessionState) SessionState.get();
+
     String cmd_trimmed = HiveStringUtils.removeComments(cmd).trim();
     String[] tokens = tokenizeCmd(cmd_trimmed);
     CommandProcessorResponse response = new CommandProcessorResponse();
@@ -206,7 +214,6 @@ public class CliDriver {
       }
     }
 
-    ss.resetThreadName();
     return response;
   }
 

Reply via email to