You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/08/05 13:31:44 UTC

[iotdb] 01/01: [ISSUE-3693] Memory leaks when executing select-into clauses

This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch issue-3693
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit f4ab1b9a0e79447b5c9d899cfae9c2f96cd12539
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Thu Aug 5 21:31:03 2021 +0800

    [ISSUE-3693] Memory leaks when executing select-into clauses
---
 .../src/main/java/org/apache/iotdb/db/cost/statistic/Operation.java | 3 ++-
 server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/cost/statistic/Operation.java b/server/src/main/java/org/apache/iotdb/db/cost/statistic/Operation.java
index b73691d..ccb2109 100644
--- a/server/src/main/java/org/apache/iotdb/db/cost/statistic/Operation.java
+++ b/server/src/main/java/org/apache/iotdb/db/cost/statistic/Operation.java
@@ -24,7 +24,8 @@ public enum Operation {
   EXECUTE_ROWS_PLAN_IN_BATCH("EXECUTE_ROWS_PLAN_IN_BATCH"),
   EXECUTE_MULTI_TIMESERIES_PLAN_IN_BATCH("EXECUTE_MULTI_TIMESERIES_PLAN_IN_BATCH"),
   EXECUTE_RPC_BATCH_INSERT("EXECUTE_RPC_BATCH_INSERT"),
-  EXECUTE_QUERY("EXECUTE_QUERY");
+  EXECUTE_QUERY("EXECUTE_QUERY"),
+  EXECUTE_SELECT_INTO("EXECUTE_SELECT_INTO");
 
   public String getName() {
     return name;
diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 4c45e09..e834538 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -1022,12 +1022,10 @@ public class TSServiceImpl implements TSIService.Iface {
       }
 
       return RpcUtils.getTSExecuteStatementResp(TSStatusCode.SUCCESS_STATUS).setQueryId(queryId);
-    } catch (Exception e) {
-      sessionManager.releaseQueryResourceNoExceptions(queryId);
-      throw e;
     } finally {
+      sessionManager.releaseQueryResourceNoExceptions(queryId);
       queryTimeManager.unRegisterQuery(queryId, queryPlan);
-      Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_QUERY, startTime);
+      Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_SELECT_INTO, startTime);
       long costTime = System.currentTimeMillis() - startTime;
       if (costTime >= config.getSlowQueryThreshold()) {
         SLOW_SQL_LOGGER.info("Cost: {} ms, sql is {}", costTime, statement);