[ 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/22/20, 2:49 AM: -------------------------------------------------------------- In a busy env, the operation may be pended(asyncPrepare is enabled). 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, perhaps any one of the state with it order being greater or equal to pending is possible, The operation _cleanup_ should be carefully deal with, otherwise we may see npe somewhere. was (Author: dengzh): In a busy env, the operation may be pended(asyncPrepare is enabled). 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, perhaps any one of the state with it order being greater or equal to pending is possible, so cannot just use _if (shouldRunAsync() && state == OperationState.PENDING)_ here, but the operation with original 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. > 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: 0.5h > 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)