You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "lvyankui (Jira)" <ji...@apache.org> on 2021/07/29 07:10:00 UTC

[jira] [Created] (HIVE-25402) When Hive client has multiple statements without close. queryIdOperation in OperationManager class will exist object that cannot be released

lvyankui created HIVE-25402:
-------------------------------

             Summary: When Hive client has multiple statements without close. queryIdOperation in OperationManager class will exist object that cannot be released
                 Key: HIVE-25402
                 URL: https://issues.apache.org/jira/browse/HIVE-25402
             Project: Hive
          Issue Type: Bug
          Components: HiveServer2
    Affects Versions: All Versions
            Reporter: lvyankui


Hive client code has multiple statements without close

connect = DriverManager.getConnection(jdbcUrl, user, password);
PrintWriter pw = new PrintWriter("/tmp/hive.result" );
Statement stmt = connect.createStatement();
Statement stmt1 = connect.createStatement();
Statement stmt2 = connect.createStatement();
String sql = "select * from test";
runSQL(stmt, sql, pw);
runSQL(stmt1, sql, pw);
runSQL(stmt2, sql, pw);

 

OperationManager  removeOperation  method

private Operation removeOperation(OperationHandle opHandle) {
 Operation operation = handleToOperation.remove(opHandle);
 if (operation == null) {
 throw new RuntimeException("Operation does not exist: " + opHandle);
 }
 String queryId = getQueryId(operation);
 *queryIdOperation.remove(queryId);*

 

The key of queryIdOperation is queryIdOperation is queryId, queryId is  getted from HiveConf. A new queryId will be generated when a new queryPlan is generated and set it into HiveConf.  If Hive client code has multiple statements without close, when sqls execute complete, queryIdOperation can only release the object whose queryId is last generated,other object cannot be released.



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