You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/03/29 17:23:56 UTC
[impala] 02/03: IMPALA-8368: Fix exception thrown by create
database/table with Ranger enabled
This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 826747bc4c8fc575f1cf8d25fdf7d8a2c9b86e42
Author: Austin Nobis <an...@cloudera.com>
AuthorDate: Thu Mar 28 11:10:58 2019 -0700
IMPALA-8368: Fix exception thrown by create database/table with Ranger enabled
Previously, an exception would be thrown when a create database or
create table command was run and Ranger was enabled. This patch removes
the code that would throw the invalid exception from
RangerCatalogdAuthorizationManager.
Testing:
- The python E2E test was updated to create and drop a database to cover
the missing test case.
- All E2E tests were run
- All FE tests were run
Change-Id: I430b2e67cccce97dc0fc99f655fcfd7db2072b13
Reviewed-on: http://gerrit.cloudera.org:8080/12878
Reviewed-by: Fredy Wijaya <fw...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
.../ranger/RangerCatalogdAuthorizationManager.java | 4 ---
tests/authorization/test_ranger.py | 33 +++++++++++++++-------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/authorization/ranger/RangerCatalogdAuthorizationManager.java b/fe/src/main/java/org/apache/impala/authorization/ranger/RangerCatalogdAuthorizationManager.java
index ca54580..9e2eb88 100644
--- a/fe/src/main/java/org/apache/impala/authorization/ranger/RangerCatalogdAuthorizationManager.java
+++ b/fe/src/main/java/org/apache/impala/authorization/ranger/RangerCatalogdAuthorizationManager.java
@@ -165,16 +165,12 @@ public class RangerCatalogdAuthorizationManager implements AuthorizationManager
public void updateDatabaseOwnerPrivilege(String serverName, String databaseName,
String oldOwner, PrincipalType oldOwnerType, String newOwner,
PrincipalType newOwnerType, TDdlExecResponse response) throws ImpalaException {
- throw new UnsupportedOperationException(String.format(
- "%s is not supported in Catalogd", ClassUtil.getMethodName()));
}
@Override
public void updateTableOwnerPrivilege(String serverName, String databaseName,
String tableName, String oldOwner, PrincipalType oldOwnerType, String newOwner,
PrincipalType newOwnerType, TDdlExecResponse response) throws ImpalaException {
- throw new UnsupportedOperationException(String.format(
- "%s is not supported in Catalogd", ClassUtil.getMethodName()));
}
public static List<GrantRevokeRequest> createGrantRevokeRequests(String grantor,
diff --git a/tests/authorization/test_ranger.py b/tests/authorization/test_ranger.py
index 6f9c24c..0141aef 100644
--- a/tests/authorization/test_ranger.py
+++ b/tests/authorization/test_ranger.py
@@ -38,25 +38,38 @@ class TestRanger(CustomClusterTestSuite):
"--ranger_app_id=impala "
"--authorization_factory_class="
"org.apache.impala.authorization.ranger.RangerAuthorizationFactory")
- def test_grant_revoke(self):
+ def test_grant_revoke(self, unique_name):
user = getuser()
+ admin = "admin"
admin_client = self.create_impala_client()
user_client = self.create_impala_client()
+ unique_database = unique_name + "_db"
+ unique_table = unique_name + "_tbl"
try:
+ # Set-up temp database/table
+ admin_client.execute("drop database if exists {0} cascade".format(unique_database),
+ user=admin)
+ admin_client.execute("create database {0}".format(unique_database), user=admin)
+ admin_client.execute("create table {0}.{1} (x int)"
+ .format(unique_database, unique_table), user=admin)
+
self.execute_query_expect_success(admin_client,
- "grant select on database functional to user {0}"
- .format(user), user="admin")
+ "grant select on database {0} to user {1}"
+ .format(unique_database, user), user=admin)
# TODO: IMPALA-8293 use refresh authorization
time.sleep(35)
- self.execute_query_expect_success(user_client, "show tables in functional",
- user=user)
+ self.execute_query_expect_success(user_client, "show tables in {0}"
+ .format(unique_database), user=user)
self.execute_query_expect_success(admin_client,
- "revoke select on database functional from user "
- "{0}".format(getuser()), user="admin")
+ "revoke select on database {0} from user "
+ "{1}".format(unique_database, user), user=admin)
# TODO: IMPALA-8293 use refresh authorization
time.sleep(35)
- self.execute_query_expect_failure(user_client, "show tables in functional")
+ self.execute_query_expect_failure(user_client, "show tables in {0}"
+ .format(unique_database))
finally:
- admin_client.execute("revoke select on database functional from user {0}"
- .format(getuser()), user="admin")
+ admin_client.execute("revoke select on database {0} from user {1}"
+ .format(unique_database, user), user=admin)
+ admin_client.execute("drop database if exists {0} cascade".format(unique_database),
+ user=admin)