[ 
https://issues.apache.org/jira/browse/HIVE-23633?focusedWorklogId=444369&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-444369
 ]

ASF GitHub Bot logged work on HIVE-23633:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jun/20 16:13
            Start Date: 11/Jun/20 16:13
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on a change in pull request #1071:
URL: https://github.com/apache/hive/pull/1071#discussion_r438901224



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -13317,6 +13325,10 @@ public int markScheduledExecutionsTimedOut(int 
timeoutSecs) throws InvalidOperat
       recoverInvalidScheduledQueryState(timeoutSecs);
       committed = commitTransaction();
       return results.size();
+    } catch (InvalidOperationException | MetaException e) {
+      throw e;
+    } catch (Exception e) {
+      throw new MetaException(e.getMessage());

Review comment:
       are these catches needed?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -12872,15 +12879,16 @@ public int deleteRuntimeStats(int maxRetainSecs) 
throws MetaException {
       return 0;
     }
     boolean committed = false;
-    try {
+    try (Query q = pm.newQuery(MRuntimeStat.class)) {
       openTransaction();
       int maxCreateTime = (int) (System.currentTimeMillis() / 1000) - 
maxRetainSecs;
-      Query q = pm.newQuery(MRuntimeStat.class);
       q.setFilter("createTime <= maxCreateTime");
       q.declareParameters("int maxCreateTime");
       long deleted = q.deletePersistentAll(maxCreateTime);
       committed = commitTransaction();
       return (int) deleted;
+    } catch (Exception e) {
+      throw new MetaException(e.getMessage());

Review comment:
       is this catch needed?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -13272,15 +13280,16 @@ public int deleteScheduledExecutions(int 
maxRetainSecs) {
       return 0;
     }
     boolean committed = false;
-    try {
+    try (Query q = pm.newQuery(MScheduledExecution.class)) {
       openTransaction();
       int maxCreateTime = (int) (System.currentTimeMillis() / 1000) - 
maxRetainSecs;
-      Query q = pm.newQuery(MScheduledExecution.class);
       q.setFilter("startTime <= maxCreateTime");
       q.declareParameters("int maxCreateTime");
       long deleted = q.deletePersistentAll(maxCreateTime);
       committed = commitTransaction();
       return (int) deleted;
+    } catch (Exception e) {

Review comment:
       is this catch needed?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -13339,5 +13351,6 @@ private void recoverInvalidScheduledQueryState(int 
timeoutSecs) {
         pm.makePersistent(e);
       }
     }
+    q.closeAll();

Review comment:
       use try-with-resources in this method




----------------------------------------------------------------
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: 444369)
    Time Spent: 1h 50m  (was: 1h 40m)

> Metastore some JDO query objects do not close properly
> ------------------------------------------------------
>
>                 Key: HIVE-23633
>                 URL: https://issues.apache.org/jira/browse/HIVE-23633
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Zhihua Deng
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> After patched [HIVE-10895|https://issues.apache.org/jira/browse/HIVE-10895],  
> The metastore still has seen a memory leak on db resources: many 
> StatementImpls left unclosed.



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

Reply via email to