You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/05/10 11:21:48 UTC

[iotdb] branch rel/1.1 updated: [To rel/1.1] [IOTDB-5851] Fix Npe with limit clause

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

jackietien pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new f336a0ccfd [To rel/1.1] [IOTDB-5851] Fix Npe with limit clause
f336a0ccfd is described below

commit f336a0ccfd2ded9fabbabd58be5dabfad47a470c
Author: Liao Lanyu <14...@qq.com>
AuthorDate: Wed May 10 19:21:42 2023 +0800

    [To rel/1.1] [IOTDB-5851] Fix Npe with limit clause
---
 .../iotdb/db/mpp/execution/exchange/SharedTsBlockQueue.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/exchange/SharedTsBlockQueue.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/exchange/SharedTsBlockQueue.java
index 1be2d7fbd5..f5f1884f69 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/exchange/SharedTsBlockQueue.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/exchange/SharedTsBlockQueue.java
@@ -266,7 +266,17 @@ public class SharedTsBlockQueue {
         .getQueryPool()
         .clearMemoryReservationMap(
             localFragmentInstanceId.getQueryId(), fullFragmentInstanceId, localPlanNodeId);
-    sinkChannel.close();
+    if (sinkChannel != null) {
+      // attention: LocalSinkChannel of this SharedTsBlockQueue could be null when we close
+      // LocalSourceHandle(with limit clause it's possible) before constructing the corresponding
+      // LocalSinkChannel.
+      // If this close method is invoked by LocalSourceHandle, listener of LocalSourceHandle will
+      // remove the LocalSourceHandle from the map of MppDataExchangeManager and later when
+      // LocalSinkChannel is initialized, it will construct a new SharedTsBlockQueue.
+      // It is still safe that we let the LocalSourceHandle close successfully in this case. Because
+      // the QueryTerminator will do the final cleaning logic.
+      sinkChannel.close();
+    }
   }
 
   /** Destroy the queue and cancel the future. Should only be called in abnormal case */