-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#6716] improvement(authz): Delete catalogs if failing to execute post hook actions #6717
Conversation
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @xunliu , Would you like to take a look?
if (ClientResponse.Status.NOT_FOUND.equals(rse.getStatus())) { | ||
if (Boolean.parseBoolean( | ||
config.get(RangerAuthorizationProperties.RANGER_SERVICE_CREATE_IF_ABSENT)) | ||
&& ClientResponse.Status.NOT_FOUND.equals(rse.getStatus())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed the original design:
Before: If RANGER_SERVICE_CREATE_IF_ABSENT
is false, there will be no exception in any condition.
Now: If RANGER_SERVICE_CREATE_IF_ABSENT
is false and the service is unavailable, you will throw
throw new AuthorizationPluginException(
"Fail to get ranger service name %s, exception: %s", serviceName, rse.getMessage());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the change seems more reasonable for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xunliu, could you please help confirm the original design?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it ok
Map<String, String> wrongProperties = | ||
ImmutableMap.of( | ||
HiveConstants.METASTORE_URIS, | ||
HIVE_METASTORE_URIS, | ||
IMPERSONATION_ENABLE, | ||
"true", | ||
AUTHORIZATION_PROVIDER, | ||
"ranger", | ||
RangerAuthorizationProperties.RANGER_SERVICE_TYPE, | ||
"HadoopSQL", | ||
RangerAuthorizationProperties.RANGER_ADMIN_URL, | ||
RangerITEnv.RANGER_ADMIN_URL, | ||
RangerAuthorizationProperties.RANGER_AUTH_TYPE, | ||
RangerContainer.authType, | ||
RangerAuthorizationProperties.RANGER_USERNAME, | ||
RangerContainer.rangerUserName, | ||
RangerAuthorizationProperties.RANGER_PASSWORD, | ||
RangerContainer.rangerPassword, | ||
RangerAuthorizationProperties.RANGER_SERVICE_CREATE_IF_ABSENT, | ||
"true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is the wrong properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove the service name. This service name is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment in the here. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Assertions.assertThrows( | ||
RuntimeException.class, | ||
() -> | ||
metalake.createCatalog( | ||
"wrongTestProperties", | ||
Catalog.Type.RELATIONAL, | ||
provider, | ||
"comment", | ||
wrongProperties)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to add a check throw type or throw message function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
...anger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (ClientResponse.Status.NOT_FOUND.equals(rse.getStatus())) { | ||
if (Boolean.parseBoolean( | ||
config.get(RangerAuthorizationProperties.RANGER_SERVICE_CREATE_IF_ABSENT)) | ||
&& ClientResponse.Status.NOT_FOUND.equals(rse.getStatus())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it ok
…te post hook actions (apache#6717) ### What changes were proposed in this pull request? Delete catalogs if failing to execute post hook actions ### Why are the changes needed? Fix: apache#6716 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Add a new IT.
What changes were proposed in this pull request?
Delete catalogs if failing to execute post hook actions
Why are the changes needed?
Fix: #6716
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Add a new IT.