[
https://issues.apache.org/jira/browse/SENTRY-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sravya Tirukkovalur updated SENTRY-1184:
----------------------------------------
Description:
Currently HMSPaths.renameAuthzObject is being used for multiple cases and logic
is not being handled well causing expected behaviors to throw exceptions. This
patch makes following changes:
If oldName == newName, oldPath != newPath. This is treated as regular
newName.add(newPath), newName.delete(oldPath), so renameAuthz is not called for
this case. Example: Alter table partition rename to partition
If oldName != newName renameAuthz is called which does the following:
- If oldPath == newPath =>new_table.add(new_path),
new_table.add(old_table_partition_paths), old_table.dropAllPaths. Example:
Rename external table
- oldPath != newPath => new_table.add(new_path), old_table.dropAllPaths.
Example: Rename managed table
Also, as part of this change made updatePartial and updateFull synchronized on
UpdateableAuthzPaths object, as handling partial and full updates concurrently
can cause unexpected behavior.
java.lang.NullPointerException
at org.apache.sentry.hdfs.HMSPaths.renameAuthzObject(HMSPaths.java:571)
at
org.apache.sentry.hdfs.UpdateableAuthzPaths.applyPartialUpdate(UpdateableAuthzPaths.java:106)
at
org.apache.sentry.hdfs.UpdateableAuthzPaths.updatePartial(UpdateableAuthzPaths.java:75)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.processUpdates(SentryAuthorizationInfo.java:174)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.update(SentryAuthorizationInfo.java:131)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.run(SentryAuthorizationInfo.java:193)
was:
java.lang.NullPointerException
at org.apache.sentry.hdfs.HMSPaths.renameAuthzObject(HMSPaths.java:571)
at
org.apache.sentry.hdfs.UpdateableAuthzPaths.applyPartialUpdate(UpdateableAuthzPaths.java:106)
at
org.apache.sentry.hdfs.UpdateableAuthzPaths.updatePartial(UpdateableAuthzPaths.java:75)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.processUpdates(SentryAuthorizationInfo.java:174)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.update(SentryAuthorizationInfo.java:131)
at
org.apache.sentry.hdfs.SentryAuthorizationInfo.run(SentryAuthorizationInfo.java:193)
> Clean up HMSPaths.renameAuthzObject
> -----------------------------------
>
> Key: SENTRY-1184
> URL: https://issues.apache.org/jira/browse/SENTRY-1184
> Project: Sentry
> Issue Type: Bug
> Reporter: Sravya Tirukkovalur
> Assignee: Sravya Tirukkovalur
> Attachments: SENTRY-1184.001-branch-1.5.1.patch,
> SENTRY-1184.002.patch, SENTRY-1184.1.patch, SENTRY-1184.2.patch,
> SENTRY-1184.3.patch
>
>
> Currently HMSPaths.renameAuthzObject is being used for multiple cases and
> logic is not being handled well causing expected behaviors to throw
> exceptions. This patch makes following changes:
> If oldName == newName, oldPath != newPath. This is treated as regular
> newName.add(newPath), newName.delete(oldPath), so renameAuthz is not called
> for this case. Example: Alter table partition rename to partition
> If oldName != newName renameAuthz is called which does the following:
> - If oldPath == newPath =>new_table.add(new_path),
> new_table.add(old_table_partition_paths), old_table.dropAllPaths. Example:
> Rename external table
> - oldPath != newPath => new_table.add(new_path), old_table.dropAllPaths.
> Example: Rename managed table
> Also, as part of this change made updatePartial and updateFull synchronized
> on UpdateableAuthzPaths object, as handling partial and full updates
> concurrently can cause unexpected behavior.
> java.lang.NullPointerException
> at org.apache.sentry.hdfs.HMSPaths.renameAuthzObject(HMSPaths.java:571)
> at
> org.apache.sentry.hdfs.UpdateableAuthzPaths.applyPartialUpdate(UpdateableAuthzPaths.java:106)
> at
> org.apache.sentry.hdfs.UpdateableAuthzPaths.updatePartial(UpdateableAuthzPaths.java:75)
> at
> org.apache.sentry.hdfs.SentryAuthorizationInfo.processUpdates(SentryAuthorizationInfo.java:174)
> at
> org.apache.sentry.hdfs.SentryAuthorizationInfo.update(SentryAuthorizationInfo.java:131)
> at
> org.apache.sentry.hdfs.SentryAuthorizationInfo.run(SentryAuthorizationInfo.java:193)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)