[ 
https://issues.apache.org/jira/browse/HIVE-25158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17350708#comment-17350708
 ] 

Robbie Zhang commented on HIVE-25158:
-------------------------------------

HiveSessionImpl.setOperationLogSessionDir() uses the ID of sessionHandle to 
work out the session log directory:
https://github.com/apache/hive/blob/c10aa5370caf9b72a91c53b18dc5f8cb5c9fa6d6/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L330

The sessionHandle is created before HS2 applies the session ID provided by the 
client. If the client doesn't provide session ID, the session ID is the same as 
the ID of sessionHandle. But if the client provides session ID, the ID of 
sessionHandle and the session ID are different. In this case, the operation 
logs are stored in <operationLogRootDir>/<session_id>/ but HS2 looks for 
operation logs in <operationLogRootDir>/<sessionHandle_id>. When queries 
finish, HS2 can't can't clean up the operation logs either.


> Beeline/hive command can't get operation logs when hive.session.id is set
> -------------------------------------------------------------------------
>
>                 Key: HIVE-25158
>                 URL: https://issues.apache.org/jira/browse/HIVE-25158
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Robbie Zhang
>            Assignee: Robbie Zhang
>            Priority: Major
>
> Usually, we can see the operation logs when we run a query from beeline/hive. 
> For example, the query ID, the time taken in compiling/executing, the 
> application information, etc. But if we use "–hiveconf hive.session.id=xxxx" 
> to set the session ID, we can't see the operation logs any more. Here are 
> examples:
>  * Without hive.session.id
> {code:java}
> $ hive -e "select 1"
> SLF4J: Class path contains multiple SLF4J bindings.
> ...
> Connected to: Apache Hive (version 3.1.3000.7.1.6.0-297)
> Driver: Hive JDBC (version 3.1.3000.7.1.6.0-297)
> Transaction isolation: TRANSACTION_REPEATABLE_READ
> INFO  : Compiling 
> command(queryId=hive_20210524105207_9d0774b2-8108-4800-a5e4-3b950ae03198): 
> select 1
> INFO  : Semantic Analysis Completed (retrial = false)
> INFO  : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, 
> type:int, comment:null)], properties:null)
> INFO  : Completed compiling 
> command(queryId=hive_20210524105207_9d0774b2-8108-4800-a5e4-3b950ae03198); 
> Time taken: 0.122 seconds
> INFO  : Executing 
> command(queryId=hive_20210524105207_9d0774b2-8108-4800-a5e4-3b950ae03198): 
> select 1
> INFO  : Completed executing 
> command(queryId=hive_20210524105207_9d0774b2-8108-4800-a5e4-3b950ae03198); 
> Time taken: 0.016 seconds
> INFO  : OK
> +------+
> | _c0  |
> +------+
> | 1    |
> +------+
> 1 row selected (0.318 seconds)
> Beeline version 3.1.3000.7.1.6.0-297 by Apache Hive
> {code}
>  * With hive.session.id
> {code:java}
> $ hive --hiveconf hive.session.id=abcd -e "select 1"
> SLF4J: Class path contains multiple SLF4J bindings.
> ...
> Connected to: Apache Hive (version 3.1.3000.7.1.6.0-297)
> Driver: Hive JDBC (version 3.1.3000.7.1.6.0-297)
> Transaction isolation: TRANSACTION_REPEATABLE_READ
> +------+
> | _c0  |
> +------+
> | 1    |
> +------+
> 1 row selected (5.862 seconds)
> Beeline version 3.1.3000.7.1.6.0-297 by Apache Hive
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to