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 2022/04/19 03:47:53 UTC

[iotdb] branch DriverAbort created (now 27bad8b403)

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

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


      at 27bad8b403 Add abort method for Driver

This branch includes the following new commits:

     new 27bad8b403 Add abort method for Driver

The 1 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] 01/01: Add abort method for Driver

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

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

commit 27bad8b403b96262039c9ad5ed34672de59e3a51
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Tue Apr 19 11:47:37 2022 +0800

    Add abort method for Driver
---
 .../java/org/apache/iotdb/db/mpp/execution/DataDriver.java    |  5 +++++
 .../main/java/org/apache/iotdb/db/mpp/execution/Driver.java   | 11 +++++++++--
 .../iotdb/db/mpp/execution/FragmentInstanceContext.java       |  6 ++++++
 .../java/org/apache/iotdb/db/mpp/execution/SchemaDriver.java  |  5 +++++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/DataDriver.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/DataDriver.java
index 785d8d8db3..21aebe0214 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/DataDriver.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/DataDriver.java
@@ -173,6 +173,11 @@ public class DataDriver implements Driver {
     }
   }
 
+  @Override
+  public void failed(Throwable t) {
+    driverContext.failed(t);
+  }
+
   /**
    * init seq file list and unseq file list in QueryDataSource and set it into each SourceNode TODO
    * we should change all the blocked lock operation into tryLock
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/Driver.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Driver.java
index 845655a1bc..f211ce593c 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/Driver.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Driver.java
@@ -26,8 +26,8 @@ import io.airlift.units.Duration;
 import java.io.Closeable;
 
 /**
- * ExecutableFragmentInstance encapsulates some methods which are necessary for execution scheduler
- * to run a fragment instance
+ * Driver encapsulates some methods which are necessary for execution scheduler to run a fragment
+ * instance
  */
 public interface Driver extends Closeable {
 
@@ -60,4 +60,11 @@ public interface Driver extends Closeable {
   /** clear resource used by this fragment instance */
   @Override
   void close();
+
+  /**
+   * fail current driver
+   *
+   * @param t reason cause this failure
+   */
+  void failed(Throwable t);
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
index c8f3e3ebd8..b2e51be2bc 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
@@ -23,6 +23,9 @@ import org.apache.iotdb.db.mpp.operator.OperatorContext;
 import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.query.context.QueryContext;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
@@ -31,6 +34,8 @@ import static com.google.common.base.Preconditions.checkArgument;
 
 public class FragmentInstanceContext extends QueryContext {
 
+  private static final Logger LOGGER = LoggerFactory.getLogger(FragmentInstanceContext.class);
+
   private final FragmentInstanceId id;
 
   // TODO if we split one fragment instance into multiple pipelines to run, we need to replace it
@@ -93,6 +98,7 @@ public class FragmentInstanceContext extends QueryContext {
   }
 
   public void failed(Throwable cause) {
+    LOGGER.warn("Fragment Instance {} failed.", id, cause);
     state.set(FragmentInstanceState.FAILED);
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/SchemaDriver.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/SchemaDriver.java
index 47edf98973..4020db4593 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/SchemaDriver.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/SchemaDriver.java
@@ -164,4 +164,9 @@ public class SchemaDriver implements Driver {
       driverContext.failed(t);
     }
   }
+
+  @Override
+  public void failed(Throwable t) {
+    driverContext.failed(t);
+  }
 }