You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2020/05/24 02:06:41 UTC
[hive] branch master updated: HIVE-23534: NPE in
RetryingMetaStoreClient#invoke when catching MetaException with no message
(Stamatis Zampetakis, reviewed by Jesus Camacho Rodriguez)
This is an automated email from the ASF dual-hosted git repository.
jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 30b3905 HIVE-23534: NPE in RetryingMetaStoreClient#invoke when catching MetaException with no message (Stamatis Zampetakis, reviewed by Jesus Camacho Rodriguez)
30b3905 is described below
commit 30b390533c5da3f78964902b345b96e06acf5172
Author: Stamatis Zampetakis <za...@gmail.com>
AuthorDate: Sat May 23 19:05:28 2020 -0700
HIVE-23534: NPE in RetryingMetaStoreClient#invoke when catching MetaException with no message (Stamatis Zampetakis, reviewed by Jesus Camacho Rodriguez)
---
.../hive/metastore/RetryingMetaStoreClient.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
index f97f638..bf47d1c 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
@@ -29,6 +29,7 @@ import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
@@ -59,6 +60,8 @@ import com.google.common.annotations.VisibleForTesting;
public class RetryingMetaStoreClient implements InvocationHandler {
private static final Logger LOG = LoggerFactory.getLogger(RetryingMetaStoreClient.class.getName());
+ private static final Pattern IO_JDO_TRANSPORT_PROTOCOL_EXCEPTION_PATTERN =
+ Pattern.compile("(?s).*(IO|JDO[a-zA-Z]*|TProtocol|TTransport)Exception.*");
private final IMetaStoreClient base;
private final UserGroupInformation ugi;
@@ -233,16 +236,13 @@ public class RetryingMetaStoreClient implements InvocationHandler {
} else if ((t instanceof TProtocolException) || (t instanceof TTransportException)) {
// TODO: most protocol exceptions are probably unrecoverable... throw?
caughtException = (TException)t;
- } else if ((t instanceof MetaException) && t.getMessage().matches(
- "(?s).*(JDO[a-zA-Z]*|TProtocol|TTransport)Exception.*") &&
- !t.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) {
+ } else if ((t instanceof MetaException) && isRecoverableMetaException((MetaException) t)) {
caughtException = (MetaException)t;
} else {
throw t;
}
} catch (MetaException e) {
- if (e.getMessage().matches("(?s).*(IO|TTransport)Exception.*") &&
- !e.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) {
+ if (isRecoverableMetaException(e)) {
caughtException = e;
} else {
throw e;
@@ -261,6 +261,17 @@ public class RetryingMetaStoreClient implements InvocationHandler {
return ret;
}
+ private static boolean isRecoverableMetaException(MetaException e) {
+ String m = e.getMessage();
+ if (m == null) {
+ return false;
+ }
+ if (m.contains("java.sql.SQLIntegrityConstraintViolationException")) {
+ return false;
+ }
+ return IO_JDO_TRANSPORT_PROTOCOL_EXCEPTION_PATTERN.matcher(m).matches();
+ }
+
/**
* Returns the UGI for the current user.
* @return the UGI for the current user.