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/01/29 06:03:14 UTC

[iotdb] branch rel/1.0 updated: [To rel/1.0] [IOTDB-5431] Fix concurrent bug caused by using synchronizedSet() in DriverScheduler

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

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


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new 534176f839 [To rel/1.0] [IOTDB-5431] Fix concurrent bug caused by using synchronizedSet() in DriverScheduler
534176f839 is described below

commit 534176f839d771fee35ae6c6044c246d2dac8067
Author: Jackie Tien <ja...@gmail.com>
AuthorDate: Sun Jan 29 14:03:08 2023 +0800

    [To rel/1.0] [IOTDB-5431] Fix concurrent bug caused by using synchronizedSet() in DriverScheduler
---
 .../db/mpp/execution/schedule/DriverScheduler.java | 23 ++++++++++++----------
 1 file changed, 13 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 dac98a07ee..680dc9ee6a 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
@@ -394,16 +394,19 @@ public class DriverScheduler implements IDriverScheduler, IService {
         QueryId queryId = task.getId().getQueryId();
         Set<DriverTask> queryRelatedTasks = queryMap.remove(queryId);
         if (queryRelatedTasks != null) {
-          for (DriverTask otherTask : queryRelatedTasks) {
-            if (task.equals(otherTask)) {
-              continue;
-            }
-            otherTask.lock();
-            try {
-              otherTask.setAbortCause(FragmentInstanceAbortedException.BY_QUERY_CASCADING_ABORTED);
-              clearDriverTask(otherTask);
-            } finally {
-              otherTask.unlock();
+          synchronized (queryRelatedTasks) {
+            for (DriverTask otherTask : queryRelatedTasks) {
+              if (task.equals(otherTask)) {
+                continue;
+              }
+              otherTask.lock();
+              try {
+                otherTask.setAbortCause(
+                    FragmentInstanceAbortedException.BY_QUERY_CASCADING_ABORTED);
+                clearDriverTask(otherTask);
+              } finally {
+                otherTask.unlock();
+              }
             }
           }
         }