You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/04/07 07:18:49 UTC

[iotdb] branch abortFINPE created (now 0d17bd365e)

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

xiangweiwei pushed a change to branch abortFINPE
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 0d17bd365e add lock

This branch includes the following new commits:

     new 5e5c384da6 Fix npe when release fi
     new 0d17bd365e add lock

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 02/02: add lock

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0d17bd365e3a0ad22ac8b3708095e9e4ff55b098
Author: Alima777 <wx...@gmail.com>
AuthorDate: Thu Apr 6 17:29:54 2023 +0800

    add lock
---
 .../db/mpp/execution/schedule/DriverScheduler.java | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
index 733958b06e..f523331c83 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
@@ -277,16 +277,18 @@ public class DriverScheduler implements IDriverScheduler, IService {
     if (queryRelatedTasks != null) {
       Set<DriverTask> instanceRelatedTasks = queryRelatedTasks.remove(instanceId);
       if (instanceRelatedTasks != null) {
-        for (DriverTask task : instanceRelatedTasks) {
-          if (task == null) {
-            return;
-          }
-          task.lock();
-          try {
-            task.setAbortCause(DriverTaskAbortedException.BY_FRAGMENT_ABORT_CALLED);
-            clearDriverTask(task);
-          } finally {
-            task.unlock();
+        synchronized (instanceRelatedTasks) {
+          for (DriverTask task : instanceRelatedTasks) {
+            if (task == null) {
+              return;
+            }
+            task.lock();
+            try {
+              task.setAbortCause(DriverTaskAbortedException.BY_FRAGMENT_ABORT_CALLED);
+              clearDriverTask(task);
+            } finally {
+              task.unlock();
+            }
           }
         }
       }


[iotdb] 01/02: Fix npe when release fi

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5e5c384da66098352d9d7cae95e78a1607fdf12d
Author: Alima777 <wx...@gmail.com>
AuthorDate: Thu Apr 6 17:23:00 2023 +0800

    Fix npe when release fi
---
 .../db/mpp/execution/schedule/DriverScheduler.java | 28 ++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
index 6cd893f441..733958b06e 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/DriverScheduler.java
@@ -272,18 +272,22 @@ public class DriverScheduler implements IDriverScheduler, IService {
 
   @Override
   public void abortFragmentInstance(FragmentInstanceId instanceId) {
-    Set<DriverTask> instanceRelatedTasks = queryMap.get(instanceId.getQueryId()).remove(instanceId);
-    if (instanceRelatedTasks != null) {
-      for (DriverTask task : instanceRelatedTasks) {
-        if (task == null) {
-          return;
-        }
-        task.lock();
-        try {
-          task.setAbortCause(DriverTaskAbortedException.BY_FRAGMENT_ABORT_CALLED);
-          clearDriverTask(task);
-        } finally {
-          task.unlock();
+    Map<FragmentInstanceId, Set<DriverTask>> queryRelatedTasks =
+        queryMap.get(instanceId.getQueryId());
+    if (queryRelatedTasks != null) {
+      Set<DriverTask> instanceRelatedTasks = queryRelatedTasks.remove(instanceId);
+      if (instanceRelatedTasks != null) {
+        for (DriverTask task : instanceRelatedTasks) {
+          if (task == null) {
+            return;
+          }
+          task.lock();
+          try {
+            task.setAbortCause(DriverTaskAbortedException.BY_FRAGMENT_ABORT_CALLED);
+            clearDriverTask(task);
+          } finally {
+            task.unlock();
+          }
         }
       }
     }