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

[iotdb] branch master updated: Pipe: record root cause when exception is reported (#10577)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a1f9c60887e Pipe: record root cause when exception is reported (#10577)
a1f9c60887e is described below

commit a1f9c60887e042433d120b9e641205750e4a6041
Author: 马子坤 <55...@users.noreply.github.com>
AuthorDate: Tue Jul 18 17:20:55 2023 +0800

    Pipe: record root cause when exception is reported (#10577)
---
 .../java/org/apache/iotdb/db/pipe/task/subtask/PipeSubtask.java  | 9 +++++++--
 .../db/pipe/task/subtask/connector/PipeConnectorSubtask.java     | 7 ++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/PipeSubtask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/PipeSubtask.java
index 4531ed54e98..bdc494e7622 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/PipeSubtask.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/PipeSubtask.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.commons.exception.pipe.PipeRuntimeCriticalException;
 import org.apache.iotdb.commons.exception.pipe.PipeRuntimeException;
 import org.apache.iotdb.db.pipe.event.EnrichedEvent;
 import org.apache.iotdb.db.pipe.execution.scheduler.PipeSubtaskScheduler;
+import org.apache.iotdb.db.utils.ErrorHandlingUtils;
 import org.apache.iotdb.pipe.api.event.Event;
 
 import com.google.common.util.concurrent.FutureCallback;
@@ -126,8 +127,12 @@ public abstract class PipeSubtask
       final String errorMessage =
           String.format(
               "Failed to execute subtask %s(%s), "
-                  + "retry count exceeds the max retry times %d, last exception: %s",
-              taskID, this.getClass().getSimpleName(), retryCount.get(), throwable.getMessage());
+                  + "retry count exceeds the max retry times %d, last exception: %s, root cause: %s",
+              taskID,
+              this.getClass().getSimpleName(),
+              retryCount.get(),
+              throwable.getMessage(),
+              ErrorHandlingUtils.getRootCause(throwable).getMessage());
       LOGGER.warn(errorMessage, throwable);
 
       if (lastEvent instanceof EnrichedEvent) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/connector/PipeConnectorSubtask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/connector/PipeConnectorSubtask.java
index 0c59e1db0f6..da756d9d605 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/connector/PipeConnectorSubtask.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/task/subtask/connector/PipeConnectorSubtask.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.db.pipe.execution.scheduler.PipeSubtaskScheduler;
 import org.apache.iotdb.db.pipe.task.connection.BoundedBlockingPendingQueue;
 import org.apache.iotdb.db.pipe.task.subtask.DecoratingLock;
 import org.apache.iotdb.db.pipe.task.subtask.PipeSubtask;
+import org.apache.iotdb.db.utils.ErrorHandlingUtils;
 import org.apache.iotdb.pipe.api.PipeConnector;
 import org.apache.iotdb.pipe.api.event.Event;
 import org.apache.iotdb.pipe.api.event.dml.insertion.TabletInsertionEvent;
@@ -179,7 +180,11 @@ public class PipeConnectorSubtask extends PipeSubtask {
               throwable);
 
           ((EnrichedEvent) lastEvent)
-              .reportException(new PipeRuntimeConnectorCriticalException(throwable.getMessage()));
+              .reportException(
+                  new PipeRuntimeConnectorCriticalException(
+                      throwable.getMessage()
+                          + ", root cause: "
+                          + ErrorHandlingUtils.getRootCause(throwable).getMessage()));
         } else {
           LOGGER.error(
               "Failed to reconnect to the target system after {} times, "