phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject phoenix git commit: PHOENIX-4941 Handle TableExistsException when wrapped under RemoteException for SYSTEM.MUTEX table(addendum)
Date Tue, 02 Oct 2018 19:29:08 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 5635204c6 -> be54de417


PHOENIX-4941 Handle TableExistsException when wrapped under RemoteException for SYSTEM.MUTEX
table(addendum)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/be54de41
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/be54de41
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/be54de41

Branch: refs/heads/4.x-HBase-1.2
Commit: be54de4170abb978c75ca9ec22d54355ab23abc5
Parents: 5635204
Author: Ankit Singhal <ankitsinghal59@gmail.com>
Authored: Tue Oct 2 12:29:04 2018 -0700
Committer: Ankit Singhal <ankitsinghal59@gmail.com>
Committed: Tue Oct 2 12:29:04 2018 -0700

----------------------------------------------------------------------
 .../phoenix/query/ConnectionQueryServicesImpl.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/be54de41/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index d2ece24..dbfd461 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2568,12 +2568,15 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
                                     boolean foundAccessDeniedException = false;
                                     // when running spark/map reduce jobs the ADE might be
wrapped
                                     // in a RemoteException
-                                    if (inspectIfAnyExceptionInChain(e, Collections.singletonList(AccessDeniedException.class)))
{
+                                    if (inspectIfAnyExceptionInChain(e, Collections
+                                            .<Class<? extends Exception>> singletonList(AccessDeniedException.class)))
{
                                         // Pass
                                         logger.warn("Could not check for Phoenix SYSTEM tables,
assuming they exist and are properly configured");
                                         checkClientServerCompatibility(SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES,
getProps()).getName());
                                         success = true;
-                                    } else if (inspectIfAnyExceptionInChain(e, Collections.singletonList(NamespaceNotFoundException.class)))
{
+                                    } else if (inspectIfAnyExceptionInChain(e,
+                                            Collections.<Class<? extends Exception>>
singletonList(
+                                                    NamespaceNotFoundException.class))) {
                                         // This exception is only possible if SYSTEM namespace
mapping is enabled and SYSTEM namespace is missing
                                         // It implies that SYSTEM tables are not created
and hence we shouldn't provide a connection
                                         AccessDeniedException ade = new AccessDeniedException("Insufficient
permissions to create SYSTEM namespace and SYSTEM Tables");
@@ -2670,7 +2673,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
             admin.createTable(tableDesc);
         }
         catch (IOException e) {
-            if (inspectIfAnyExceptionInChain(e, Arrays.<Class<? extends IOException>>
asList(
+            if (inspectIfAnyExceptionInChain(e, Arrays.<Class<? extends Exception>>
asList(
                     AccessDeniedException.class, org.apache.hadoop.hbase.TableExistsException.class)))
{
                 // Ignore TableExistsException as another client might beat us during upgrade.
                 // Ignore AccessDeniedException, as it may be possible underpriviliged user
trying to use the connection
@@ -2683,10 +2686,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
         }
     }
     
-    private boolean inspectIfAnyExceptionInChain(Throwable io, List<Class<? extends
IOException>> ioList) {
+    private boolean inspectIfAnyExceptionInChain(Throwable io, List<Class<? extends
Exception>> ioList) {
         boolean exceptionToIgnore = false;
         for (Throwable t : Throwables.getCausalChain(io)) {
-            for (Class<? extends IOException> exception : ioList) {
+            for (Class<? extends Exception> exception : ioList) {
                 exceptionToIgnore |= isExceptionInstanceOf(t, exception);
             }
             if (exceptionToIgnore) {
@@ -2697,7 +2700,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices
implement
         return exceptionToIgnore;
     }
 
-    private boolean isExceptionInstanceOf(Throwable io, Class<? extends IOException>
exception) {
+    private boolean isExceptionInstanceOf(Throwable io, Class<? extends Exception>
exception) {
         return exception.isInstance(io) || (io instanceof RemoteException
                 && (((RemoteException)io).getClassName().equals(exception.getName())));
     }


Mime
View raw message