You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/01 07:00:24 UTC
[doris] 09/10: [improvement](multi-catalog) return root cause of exception (#14708)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-unstable
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 5033755fd3254f08c4b186d1468902de036a7cf1
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Thu Dec 1 14:58:05 2022 +0800
[improvement](multi-catalog) return root cause of exception (#14708)
---
.../src/main/java/org/apache/doris/common/util/Util.java | 10 ++++++++++
.../java/org/apache/doris/datasource/ExternalSchemaCache.java | 4 +++-
.../org/apache/doris/planner/external/HiveScanProvider.java | 5 ++++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/Util.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/Util.java
index 7b468d7a94..6d14fc6137 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/Util.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/Util.java
@@ -556,4 +556,14 @@ public class Util {
logger.warn(msg, e);
throw new RuntimeException(msg, e);
}
+
+ public static String getRootCauseMessage(Throwable t) {
+ String rootCause = "unknown";
+ Throwable p = t;
+ while (p != null) {
+ rootCause = p.getClass().getName() + ": " + p.getMessage();
+ p = p.getCause();
+ }
+ return rootCause;
+ }
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalSchemaCache.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalSchemaCache.java
index 1e4800ee81..a2b734e144 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalSchemaCache.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalSchemaCache.java
@@ -19,6 +19,7 @@ package org.apache.doris.datasource;
import org.apache.doris.catalog.Column;
import org.apache.doris.common.Config;
+import org.apache.doris.common.util.Util;
import org.apache.doris.metric.GaugeMetric;
import org.apache.doris.metric.Metric;
import org.apache.doris.metric.MetricLabel;
@@ -89,7 +90,8 @@ public class ExternalSchemaCache {
try {
return schemaCache.get(key);
} catch (ExecutionException e) {
- throw new CacheException("failed to get schema for %s in catalog %s", e, key, catalog.getName());
+ throw new CacheException("failed to get schema for %s in catalog %s. err: %s",
+ e, key, catalog.getName(), Util.getRootCauseMessage(e));
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanProvider.java b/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanProvider.java
index e257f96359..0ee3db195c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanProvider.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanProvider.java
@@ -33,6 +33,7 @@ import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.UserException;
+import org.apache.doris.common.util.Util;
import org.apache.doris.datasource.HMSExternalCatalog;
import org.apache.doris.datasource.hive.HiveMetaStoreCache;
import org.apache.doris.datasource.hive.HiveMetaStoreCache.HivePartitionValues;
@@ -188,7 +189,9 @@ public class HiveScanProvider extends HMSTableScanProvider {
return allFiles;
} catch (Throwable t) {
LOG.warn("get file split failed for table: {}", hmsTable.getName(), t);
- throw new UserException("get file split failed for table: " + hmsTable.getName(), t);
+ throw new UserException(
+ "get file split failed for table: " + hmsTable.getName() + ", err: " + Util.getRootCauseMessage(t),
+ t);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org