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

xingtanzjr pushed a commit to branch test_ratis_0623
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/test_ratis_0623 by this push:
     new ab0f8cd19b add close logic in TSI Service
ab0f8cd19b is described below

commit ab0f8cd19bab549fbd9b59e595912bc4ddbb65bb
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Thu Jun 23 20:08:18 2022 +0800

    add close logic in TSI Service
---
 .../apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
index f467d6393d..15ffeae432 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
@@ -208,6 +208,7 @@ public class DataNodeTSIServiceImpl implements 
TSIEventHandler {
 
   @Override
   public TSStatus closeSession(TSCloseSessionReq req) {
+    SESSION_MANAGER.releaseSessionResource(req.sessionId, 
this::cleanupQueryExecution);
     return new TSStatus(
         !SESSION_MANAGER.closeSession(req.sessionId)
             ? RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR)
@@ -217,11 +218,13 @@ public class DataNodeTSIServiceImpl implements 
TSIEventHandler {
   @Override
   public TSStatus cancelOperation(TSCancelOperationReq req) {
     // TODO implement
+    cleanupQueryExecution(req.queryId);
     return RpcUtils.getStatus(TSStatusCode.QUERY_NOT_ALLOWED, "Cancellation is 
not implemented");
   }
 
   @Override
   public TSStatus closeOperation(TSCloseOperationReq req) {
+    cleanupQueryExecution(req.queryId);
     return SESSION_MANAGER.closeOperation(
         req.sessionId, req.queryId, req.statementId, req.isSetStatementId(), 
req.isSetQueryId());
   }
@@ -1295,7 +1298,6 @@ public class DataNodeTSIServiceImpl implements 
TSIEventHandler {
   public void handleClientExit() {
     Long sessionId = SESSION_MANAGER.getCurrSessionId();
     if (sessionId != null) {
-      SESSION_MANAGER.releaseSessionResource(sessionId, 
this::cleanupQueryExecution);
       TSCloseSessionReq req = new TSCloseSessionReq(sessionId);
       closeSession(req);
     }

Reply via email to