Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 1da8e8608 -> ca5c9d03c


PHOENIX-4633 Handle the creation of SYSTEM.CATALOG correctly for users that 
don't have CREATE access on SYSTEM.CATALOG


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: ca5c9d03ceb619f6b8fcb3f443907a0ccf0b9cd0
Parents: 1da8e86
Author: Thomas D'Silva <tdsi...@apache.org>
Authored: Wed Feb 28 14:32:27 2018 -0800
Committer: Thomas D'Silva <tdsi...@apache.org>
Committed: Fri Mar 2 15:51:33 2018 -0800

----------------------------------------------------------------------
 .../phoenix/query/ConnectionQueryServicesImpl.java  | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ca5c9d03/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 6926c4e..6bff885 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
@@ -129,6 +129,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
+import org.apache.hadoop.ipc.RemoteException;
 import org.apache.phoenix.compile.MutationPlan;
 import org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataEndpointImpl;
@@ -2449,7 +2450,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
                                         setUpgradeRequired();
                                     }
                                 } catch (PhoenixIOException e) {
-                                    if 
(!Iterables.isEmpty(Iterables.filter(Throwables.getCausalChain(e), 
AccessDeniedException.class))) {
+                                    boolean foundAccessDeniedException = false;
+                                    // when running spark/map reduce jobs the 
ADE might be wrapped
+                                    // in a RemoteException
+                                    for (Throwable t : 
Throwables.getCausalChain(e)) {
+                                        if (t instanceof AccessDeniedException
+                                                || (t instanceof 
RemoteException
+                                                        && ((RemoteException) 
t).getClassName()
+                                                                
.equals(AccessDeniedException.class
+                                                                        
.getName()))) {
+                                            foundAccessDeniedException = true;
+                                            break;
+                                        }
+                                    }
+                                    if (foundAccessDeniedException) {
                                         // 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());

Reply via email to