You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/06/13 01:41:58 UTC
[doris] branch master updated: [fix](hive) fix NPE of hive meta store client (#20664)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e28187feb7 [fix](hive) fix NPE of hive meta store client (#20664)
e28187feb7 is described below
commit e28187feb733fce70da6a8780e7a0e2fdb5989db
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Tue Jun 13 09:41:49 2023 +0800
[fix](hive) fix NPE of hive meta store client (#20664)
The failed to connect to hive meta store, the exception will be thrown.
But there is a bug that the exception object may not be set, causing NPE.
---
.../hadoop/hive/metastore/HiveMetaStoreClient.java | 25 ++++++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/fe/fe-core/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 21ade60d07..852c4a289d 100644
--- a/fe/fe-core/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/fe/fe-core/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -18,7 +18,6 @@
package org.apache.hadoop.hive.metastore;
-import org.apache.doris.catalog.HMSResource;
import org.apache.doris.datasource.hive.HiveVersionUtil;
import org.apache.doris.datasource.hive.HiveVersionUtil.HiveVersion;
import org.apache.doris.datasource.property.constants.HMSProperties;
@@ -218,17 +217,17 @@ import org.apache.hadoop.hive.metastore.utils.SecurityUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import shade.doris.hive.org.apache.thrift.TApplicationException;
import shade.doris.hive.org.apache.thrift.TException;
import shade.doris.hive.org.apache.thrift.protocol.TBinaryProtocol;
import shade.doris.hive.org.apache.thrift.protocol.TCompactProtocol;
import shade.doris.hive.org.apache.thrift.protocol.TProtocol;
+import shade.doris.hive.org.apache.thrift.transport.TFramedTransport;
import shade.doris.hive.org.apache.thrift.transport.TSocket;
import shade.doris.hive.org.apache.thrift.transport.TTransport;
import shade.doris.hive.org.apache.thrift.transport.TTransportException;
-import shade.doris.hive.org.apache.thrift.transport.TFramedTransport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -317,7 +316,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
private final HiveVersion hiveVersion;
- static final protected Logger LOG = LoggerFactory.getLogger(HiveMetaStoreClient.class);
+ private static final Logger LOG = LogManager.getLogger(HiveMetaStoreClient.class);
//copied from ErrorMsg.java
public static final String REPL_EVENTS_MISSING_IN_METASTORE = "Notification events are missing in the meta store.";
@@ -621,6 +620,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
private void open() throws MetaException {
isConnected = false;
TTransportException tte = null;
+ MetaException lastException = null;
boolean useSSL = MetastoreConf.getBoolVar(conf, ConfVars.USE_SSL);
boolean useSasl = MetastoreConf.getBoolVar(conf, ConfVars.USE_THRIFT_SASL);
boolean useFramedTransport = MetastoreConf.getBoolVar(conf, ConfVars.USE_THRIFT_FRAMED_TRANSPORT);
@@ -737,7 +737,8 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
} catch (MetaException e) {
LOG.error("Unable to connect to metastore with URI " + store
- + " in attempt " + attempt, e);
+ + " in attempt " + attempt, e);
+ lastException = e;
}
if (isConnected) {
break;
@@ -753,8 +754,18 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
if (!isConnected) {
+ String msg = "";
+ if (tte == null) {
+ if (lastException != null) {
+ msg = StringUtils.stringifyException(lastException);
+ } else {
+ msg = "unknown reason";
+ }
+ } else {
+ msg = StringUtils.stringifyException(tte);
+ }
throw new MetaException("Could not connect to meta store using any of the URIs provided." +
- " Most recent failure: " + StringUtils.stringifyException(tte));
+ " Most recent failure: " + msg);
}
snapshotActiveConf();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org