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

Zhihua Deng edited comment on HIVE-23727 at 6/19/20, 2:00 PM:
--------------------------------------------------------------

Fix: the state can only be one of canceled, closed, timeout passed to the 
method cleanup, and set it to the state of the operation, so we have no idea of 
the original state the operation held after, perhaps any one of the state with 
order is greater or equal to pending is possible, so cannot just use _if 
(shouldRunAsync() && state == OperationState.PENDING)_ here, but the pending 
state should be carefully deal with, otherwise we may see npe somewhere. There 
also sees a npe when canceling a running query with the originally cleanup, 
maybe it's ok to remove the whole _if_ branch.


was (Author: dengzh):
Fix: the state can only be one of canceled, closed, timeout passed to the 
method cleanup, and set it to the state of the operation, so we have no idea of 
the state the operation held before, perhaps any one of the state with order is 
greater or equal to pending is possible, so cannot just use _if 
(shouldRunAsync() && state == OperationState.PENDING)_ here, but the pending 
state should be carefully deal with, otherwise we may see npe somewhere, but 
there also sees a npe when canceling a running query with the originally 
cleanup, maybe it's ok to remove the whole _if_ branch.

> Improve SQLOperation log handling when cleanup
> ----------------------------------------------
>
>                 Key: HIVE-23727
>                 URL: https://issues.apache.org/jira/browse/HIVE-23727
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Zhihua Deng
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The SQLOperation checks _if (shouldRunAsync() && state != 
> OperationState.CANCELED && state != OperationState.TIMEDOUT)_ to cancel the 
> background task. If true, the state should not be OperationState.CANCELED, so 
> logging under the state == OperationState.CANCELED should never happen.
>  



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

Reply via email to