Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#3035] fix(catalog-hive): catch Exception instead of Throwable (#3041)

lwyang5e09e3e9dff6
diff --git a/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveCatalogOperations.java b/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveCatalogOperations.java
index 5f5d7c836d..9a089647f3 100644
--- a/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveCatalogOperations.java
+++ b/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveCatalogOperations.java
@@ -218,8 +218,8 @@ public class HiveCatalogOperations implements CatalogOperations, SupportsSchemas
() -> {
try {
kerberosLoginUgi.checkTGTAndReloginFromKeytab();
- } catch (Throwable throwable) {
- LOG.error("Fail to refresh ugi token: ", throwable);
+ } catch (Exception e) {
+ LOG.error("Fail to refresh ugi token: ", e);
}
},
checkInterval,
diff --git a/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveClientPool.java b/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveClientPool.java
index 97efe6a2c7..c5c7cae704 100644
--- a/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveClientPool.java
+++ b/catalogs/catalog-hive/src/main/java/com/datastrato/gravitino/catalog/hive/HiveClientPool.java
@@ -84,16 +84,16 @@ public class HiveClientPool extends ClientPoolImpl<IMetaStoreClient, TException>
}
} catch (MetaException e) {
throw new RuntimeException("Failed to connect to Hive Metastore", e);
- } catch (Throwable t) {
- if (t.getMessage().contains("Another instance of Derby may have already booted")) {
+ } catch (Exception e) {
+ if (e.getMessage().contains("Another instance of Derby may have already booted")) {
throw new RuntimeException(
"Failed to start an embedded metastore because embedded "
+ "Derby supports only one client at a time. To fix this, use a metastore that supports "
+ "multiple clients.",
- t);
+ e);
}
- throw new RuntimeException("Failed to connect to Hive Metastore", t);
+ throw new RuntimeException("Failed to connect to Hive Metastore", e);
}
}