[ https://issues.apache.org/jira/browse/HIVE-25203?focusedWorklogId=607473&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-607473 ]
ASF GitHub Bot logged work on HIVE-25203: ----------------------------------------- Author: ASF GitHub Bot Created on: 06/Jun/21 04:11 Start Date: 06/Jun/21 04:11 Worklog Time Spent: 10m Work Description: abstractdog opened a new pull request #2353: URL: https://github.com/apache/hive/pull/2353 ### What changes were proposed in this pull request? <!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below. 1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers. 2. If you fix some SQL features, you can provide some references of other DBMSes. 3. If there is design documentation, please add the link. 4. If there is a discussion in the mailing list, please add the link. --> ### Why are the changes needed? <!-- Please clarify why the changes are needed. For instance, 1. If you propose a new API, clarify the use case for a new API. 2. If you fix a bug, you can clarify why it is a bug. --> ### Does this PR introduce _any_ user-facing change? <!-- Note that it means *any* user-facing change including all aspects such as the documentation fix. If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible. If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master. If no, write 'No'. --> ### How was this patch tested? <!-- If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 607473) Remaining Estimate: 0h Time Spent: 10m > HiveQueryResultSet and client operation are not expected to be closed twice > --------------------------------------------------------------------------- > > Key: HIVE-25203 > URL: https://issues.apache.org/jira/browse/HIVE-25203 > Project: Hive > Issue Type: Bug > Reporter: László Bodor > Assignee: László Bodor > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > While testing retry scenarios of HIVE-24786, we found that > HiveQueryResultSet.close() is called twice, which is not expected. There are > 2 different issues here: > 1. ResultSet should not handle Statement as in HiveQueryResultSet: > {code} > if (this.statement != null && (this.statement instanceof HiveStatement)) { > HiveStatement s = (HiveStatement) this.statement; > s.closeClientOperation(); > {code} > The hiearchy of Connection(HiveConnection) -> Statement(HiveStatement) -> > ResultSet(HiveQueryResultSet) should be respected in a sense that the parent > can handle child but not the opposite way, only except a single case, where > the state of the result set has an effect on statement's state, which is > [Statement.closeOnCompletion|https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#closeOnCompletion()], > which was introduced by HIVE-22698. > The above logic was introduced by > [HIVE-4974|https://github.com/apache/hive/blame/master/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java#L276]. > Its intention was to make children able to return their parents, but that > doesn't mean they should handle their parents' lifecycle. > 2. Also, HiveStatement should close HiveQueryResultSet only if it's not > already closed, so it would make sense to check ResultSet.isClosed() before > closing. This is for the very same reason as another change above, to avoid > duplicated close logic. > Background: under normal circumstances, a close operation is idempotent, we > should not worry about any side effects of calling it twice, but while > testing HIVE-24786, we found strange issues where in case of a > SocketTimeoutException, such code path was hit in the jdbc client, that made > HiveStatement.closeClientOperation() to be called twice, and it led to a > WARNING on HS2 side. This is not expected as the operation close is protected > by stmtHandle != null check, but yet it ran twice. To avoid situations like > this, cleaning up duplicated close calls would help. -- This message was sent by Atlassian Jira (v8.3.4#803005)