This is an automated email from the ASF dual-hosted git repository. apurtell pushed a commit to branch 4.x-HBase-1.5 in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit 75d3bc0518aea777f665367ea5043a04bd098461 Author: Andrew Purtell <apurt...@apache.org> AuthorDate: Fri May 10 10:44:23 2019 -0700 PHOENIX-5277 Fixups for interface changes in HBase 1.5 --- dev/test-patch.properties | 3 +- phoenix-assembly/pom.xml | 2 +- phoenix-client/pom.xml | 2 +- phoenix-core/pom.xml | 2 +- .../hadoop/hbase/ipc/PhoenixRpcScheduler.java | 18 ++++++++++-- .../coprocessor/PhoenixAccessController.java | 24 +++++---------- .../PhoenixMetaDataCoprocessorHost.java | 34 +++++++++++++++++----- phoenix-pherf/pom.xml | 2 +- phoenix-server/pom.xml | 2 +- phoenix-tracing-webapp/pom.xml | 2 +- pom.xml | 4 +-- 11 files changed, 59 insertions(+), 36 deletions(-) diff --git a/dev/test-patch.properties b/dev/test-patch.properties index b3dc46f..73ebbe1 100644 --- a/dev/test-patch.properties +++ b/dev/test-patch.properties @@ -27,8 +27,7 @@ MAX_LINE_LENGTH=100 # All supported branches for testing with precommit build # be sure to consider branch name prefixes in the order, ie, 4.x should appear # before 4 since the latter is a prefix -BRANCH_NAMES="4.x-HBase-1.2 4.x-HBase-1.3 4.x-HBase-1.4 master" - +BRANCH_NAMES="4.x-HBase-1.3 4.x-HBase-1.4 4.x-HBase-1.5 master" # All supported Hadoop versions that we want to test the compilation with HADOOP2_VERSIONS="2.6.5 2.7.3 2.8.0" diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml index 2ee0ad8..2991ff1 100644 --- a/phoenix-assembly/pom.xml +++ b/phoenix-assembly/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-assembly</artifactId> <name>Phoenix Assembly</name> diff --git a/phoenix-client/pom.xml b/phoenix-client/pom.xml index 9143b9a..15b6ddc 100644 --- a/phoenix-client/pom.xml +++ b/phoenix-client/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-client</artifactId> <name>Phoenix Client</name> diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index 12b291c..e08445f 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-core</artifactId> <name>Phoenix Core</name> diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java b/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java index 888084d..cb293ae 100644 --- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java +++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java @@ -164,6 +164,20 @@ public class PhoenixRpcScheduler extends RpcScheduler { public int getActiveScanRpcHandlerCount() { return delegate.getActiveScanRpcHandlerCount(); } - - + + @Override + public int getActiveGeneralRpcHandlerCount() { + return delegate.getActiveGeneralRpcHandlerCount(); + } + + @Override + public int getActivePriorityRpcHandlerCount() { + return delegate.getActivePriorityRpcHandlerCount(); + } + + @Override + public int getActiveReplicationRpcHandlerCount() { + return delegate.getActiveReplicationRpcHandlerCount(); + } + } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java index 1ef38bd..59d3036 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixAccessController.java @@ -138,7 +138,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { htd.addFamily(new HColumnDescriptor(familyName)); } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { - observer.preCreateTable(new ObserverContext<MasterCoprocessorEnvironment>(), htd, null); + observer.preCreateTable(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), htd, null); } } @@ -317,11 +317,11 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { for (BaseMasterAndRegionObserver observer : getAccessControllers()) { if (tableType != PTableType.VIEW) { - observer.preDeleteTable(new ObserverContext<MasterCoprocessorEnvironment>(), physicalTableName); + observer.preDeleteTable(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), physicalTableName); } if (indexes != null) { for (PTable index : indexes) { - observer.preDeleteTable(new ObserverContext<MasterCoprocessorEnvironment>(), + observer.preDeleteTable(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), TableName.valueOf(index.getPhysicalName().getBytes())); } } @@ -338,7 +338,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { if (!accessCheckEnabled) { return; } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { if (tableType != PTableType.VIEW) { - observer.preModifyTable(new ObserverContext<MasterCoprocessorEnvironment>(), physicalTableName, + observer.preModifyTable(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), physicalTableName, new HTableDescriptor(physicalTableName)); } } @@ -352,7 +352,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { throws IOException { if (!accessCheckEnabled) { return; } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { - observer.preListNamespaceDescriptors(new ObserverContext<MasterCoprocessorEnvironment>(), + observer.preListNamespaceDescriptors(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), Arrays.asList(NamespaceDescriptor.create(schemaName).build())); } } @@ -362,7 +362,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { throws IOException { if (!accessCheckEnabled) { return; } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { - observer.preCreateNamespace(new ObserverContext<MasterCoprocessorEnvironment>(), + observer.preCreateNamespace(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), NamespaceDescriptor.create(schemaName).build()); } } @@ -372,7 +372,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { throws IOException { if (!accessCheckEnabled) { return; } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { - observer.preDeleteNamespace(new ObserverContext<MasterCoprocessorEnvironment>(), schemaName); + observer.preDeleteNamespace(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), schemaName); } } @@ -382,7 +382,7 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { throws IOException { if (!accessCheckEnabled) { return; } for (BaseMasterAndRegionObserver observer : getAccessControllers()) { - observer.preModifyTable(new ObserverContext<MasterCoprocessorEnvironment>(), physicalTableName, + observer.preModifyTable(new ObserverContext<MasterCoprocessorEnvironment>(getActiveUser()), physicalTableName, new HTableDescriptor(physicalTableName)); } // Check for read access in case of rebuild @@ -613,14 +613,6 @@ public class PhoenixAccessController extends BaseMetaDataEndpointObserver { } return false; } - - public static List<String> getSuperUsers() { - return superUsers; - } - - public static User getSystemUser() { - return systemUser; - } } public String authString(String user, TableName table, Set<Action> actions) { diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixMetaDataCoprocessorHost.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixMetaDataCoprocessorHost.java index 07a3122..e089308 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixMetaDataCoprocessorHost.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixMetaDataCoprocessorHost.java @@ -31,10 +31,13 @@ import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.coprocessor.ObserverContext; import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; +import org.apache.hadoop.hbase.ipc.RpcServer; import org.apache.hadoop.hbase.metrics.MetricRegistry; import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost; import org.apache.hadoop.hbase.regionserver.RegionServerServices; +import org.apache.hadoop.hbase.security.User; +import org.apache.hadoop.hbase.security.UserProvider; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.schema.PIndexState; @@ -44,6 +47,7 @@ import org.apache.phoenix.schema.PTableType; public class PhoenixMetaDataCoprocessorHost extends CoprocessorHost<PhoenixMetaDataCoprocessorHost.PhoenixMetaDataControllerEnvironment> { private RegionCoprocessorEnvironment env; + private UserProvider userProvider; public static final String PHOENIX_META_DATA_COPROCESSOR_CONF_KEY = "hbase.coprocessor.phoenix.classes"; public static final String DEFAULT_PHOENIX_META_DATA_COPROCESSOR_CONF_KEY="org.apache.phoenix.coprocessor.PhoenixAccessController"; @@ -52,6 +56,7 @@ public class PhoenixMetaDataCoprocessorHost super(null); this.env = env; this.conf = env.getConfiguration(); + this.userProvider = UserProvider.instantiate(this.conf); boolean accessCheckEnabled = this.conf.getBoolean(QueryServices.PHOENIX_ACLS_ENABLED, QueryServicesOptions.DEFAULT_PHOENIX_ACLS_ENABLED); if (this.conf.get(PHOENIX_META_DATA_COPROCESSOR_CONF_KEY) == null && accessCheckEnabled) { @@ -63,6 +68,10 @@ public class PhoenixMetaDataCoprocessorHost private static abstract class CoprocessorOperation<T extends CoprocessorEnvironment> extends ObserverContext<T> { abstract void call(MetaDataEndpointObserver oserver, ObserverContext<T> ctx) throws IOException; + public CoprocessorOperation(User user) { + super(user); + } + public void postEnvCall(T env) {} } @@ -154,7 +163,7 @@ public class PhoenixMetaDataCoprocessorHost public void preGetTable(final String tenantId, final String tableName, final TableName physicalTableName) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -166,7 +175,7 @@ public class PhoenixMetaDataCoprocessorHost public void preCreateTable(final String tenantId, final String tableName, final TableName physicalTableName, final TableName parentPhysicalTableName, final PTableType tableType, final Set<byte[]> familySet, final Set<TableName> indexes) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -178,7 +187,7 @@ public class PhoenixMetaDataCoprocessorHost public void preDropTable(final String tenantId, final String tableName, final TableName physicalTableName, final TableName parentPhysicalTableName, final PTableType tableType, final List<PTable> indexes) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -189,7 +198,7 @@ public class PhoenixMetaDataCoprocessorHost public void preAlterTable(final String tenantId, final String tableName, final TableName physicalTableName, final TableName parentPhysicalTableName, final PTableType type) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -199,7 +208,7 @@ public class PhoenixMetaDataCoprocessorHost } public void preGetSchema(final String schemaName) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -210,7 +219,7 @@ public class PhoenixMetaDataCoprocessorHost public void preCreateSchema(final String schemaName) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -220,7 +229,7 @@ public class PhoenixMetaDataCoprocessorHost } public void preDropSchema(final String schemaName) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -231,7 +240,7 @@ public class PhoenixMetaDataCoprocessorHost public void preIndexUpdate(final String tenantId, final String indexName, final TableName physicalTableName, final TableName parentPhysicalTableName, final PIndexState newState) throws IOException { - execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>() { + execOperation(new CoprocessorOperation<PhoenixMetaDataControllerEnvironment>(getActiveUser()) { @Override public void call(MetaDataEndpointObserver observer, ObserverContext<PhoenixMetaDataControllerEnvironment> ctx) throws IOException { @@ -239,4 +248,13 @@ public class PhoenixMetaDataCoprocessorHost } }); } + + private User getActiveUser() throws IOException { + User user = RpcServer.getRequestUser(); + if (user == null) { + // for non-rpc handling, fallback to system user + user = userProvider.getCurrent(); + } + return user; + } } diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml index 747ec40..c50a544 100644 --- a/phoenix-pherf/pom.xml +++ b/phoenix-pherf/pom.xml @@ -15,7 +15,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-pherf</artifactId> diff --git a/phoenix-server/pom.xml b/phoenix-server/pom.xml index ba76460..74b4ec8 100644 --- a/phoenix-server/pom.xml +++ b/phoenix-server/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-server</artifactId> <name>Phoenix Server</name> diff --git a/phoenix-tracing-webapp/pom.xml b/phoenix-tracing-webapp/pom.xml index dfe8561..2b6a984 100755 --- a/phoenix-tracing-webapp/pom.xml +++ b/phoenix-tracing-webapp/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> </parent> <artifactId>phoenix-tracing-webapp</artifactId> diff --git a/pom.xml b/pom.xml index ab180b8..f31dbf1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix</artifactId> - <version>4.15.0-HBase-1.4-SNAPSHOT</version> + <version>4.15.0-HBase-1.5-SNAPSHOT</version> <packaging>pom</packaging> <name>Apache Phoenix</name> <description>A SQL layer over HBase</description> @@ -58,7 +58,7 @@ <top.dir>${project.basedir}</top.dir> <!-- Hadoop Versions --> - <hbase.version>1.4.0</hbase.version> + <hbase.version>1.5.0-SNAPSHOT</hbase.version> <hadoop-two.version>2.7.5</hadoop-two.version> <!-- Dependency versions -->