jerqi commented on code in PR #5321:
URL: https://github.com/apache/gravitino/pull/5321#discussion_r1824102541
##########
core/src/main/java/org/apache/gravitino/hook/TableHookDispatcher.java:
##########
@@ -96,17 +96,35 @@ public Table createTable(
@Override
public Table alterTable(NameIdentifier ident, TableChange... changes)
throws NoSuchTableException, IllegalArgumentException {
- return dispatcher.alterTable(ident, changes);
+
+ Table alteredTable = dispatcher.alterTable(ident, changes);
+ TableChange.RenameTable lastRenameChange = null;
+ for (TableChange change : changes) {
+ if (change instanceof TableChange.RenameTable) {
+ lastRenameChange = (TableChange.RenameTable) change;
+ }
+ }
+
+ if (lastRenameChange != null) {
+ AuthorizationUtils.authorizationPluginRenamePrivileges(
+ ident, Entity.EntityType.TABLE, lastRenameChange.getNewName());
+ }
+
+ return alteredTable;
}
@Override
public boolean dropTable(NameIdentifier ident) {
- return dispatcher.dropTable(ident);
+ boolean dropped = dispatcher.dropTable(ident);
+ AuthorizationUtils.authorizationPluginRemovePrivileges(ident,
Entity.EntityType.TABLE);
Review Comment:
If we succeed to delete the table but fail to delete the policy in the
authorization plugin. We can repeat to execute the operation to delete the
policy but dispatcher may return zero.
--
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]