DanielZhu58 commented on code in PR #6884:
URL: https://github.com/apache/hive/pull/6884#discussion_r4449534698
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/TransactionHandler.java:
##########
@@ -505,9 +520,90 @@ public ShowCompactResponse show_compact(ShowCompactRequest
rqst) throws TExcepti
@Override
public boolean submit_for_cleanup(CompactionRequest rqst, long
highestWriteId, long txnId)
throws TException {
+ if (!hasProxyPrivilege()) {
+ try {
+ authorizeAndPrepareCompactionRequest(rqst);
+ } catch (NoSuchObjectException e) {
+ // The table/partition does not exist (anymore): there is nothing an
untrusted caller may clean up.
+ LOG.info("Ignoring the cleanup request of {}.{}: {}",
rqst.getDbname(), rqst.getTablename(),
Review Comment:
Acknowledged. Thanks.
For non-privileged callers, submit_for_cleanup now handles a missing table
(CTAS rollback). It builds the default managed location from the database and
table name. It accepts the requested location only if it is that directory, a
sub-directory, or the lockless-reads form table txnId
The caller is authorized with a PreAlterTableEvent on a placeholder managed
table. Locations outside the managed location, including a CTAS with a custom
LOCATION, are logged at WARN and ignored. Privileged callers are unchanged.
Tests are added in TestHmsCompactionAuthorization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]