HIVE-29106: When drop a table, there is no need to verify the directo…
…ry permission
What changes were proposed in this pull request?
When drop a table, there is no need to verify the directory permission. An exception should be thrown when the table path deletion fails.
Why are the changes needed?
When HiveServer2 integrates Ranger for authentication, there will be a bug in the permission verification. Ranger has already granted write permissions for the database tables and even partitions. However, when attempting to delete a table, it still prompts that there is no permission for the database directory or the table directory, resulting in the inability to delete the table.
The correct solution is to remove the table without verifying the directory write permission, not to catch the exception when deleting the data directory, but to throw the exception instead, and at the same time roll back the metadata information.
Does this PR introduce any user-facing change?
No
How was this patch tested?
@deniskuzZ Please review the code.Thanks
@ayushtkn Please help review the code.Thank you.
Quality Gate passed
Issues
3 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@deniskuzZ please check again
@saihemanth-cloudera please check again
@deniskuzZ I can't see the error message indicating the compilation failure.
@deniskuzZ I can't see the error message indicating the compilation failure.
@saihemanth-cloudera
hi @zxl-333, sorry for late reply.
I don't see the compilation failure, but qtest outputs have changed, try running with -Dtest.output.overwrite=true and see the diff
https://ci.hive.apache.org/job/hive-precommit/job/PR-5997/10/
MetaException(message:java.io.IOException: Failed to delete directory: file:/tmp . Exception detail : MetaException(message:Unable to delete directory: file:/tmp)
at org.apache.hadoop.hive.metastore.HiveMetaStoreFsImpl.deleteDir(HiveMetaStoreFsImpl.java:45)
at org.apache.hadoop.hive.metastore.Warehouse.deleteDir(Warehouse.java:475)
at org.apache.hadoop.hive.metastore.HMSHandler.deleteDataExcludeCmroot(HMSHandler.java:3208)
at org.apache.hadoop.hive.metastore.HMSHandler.deleteTableData(HMSHandler.java:3121)
at org.apache.hadoop.hive.metastore.HMSHandler.drop_table_core(HMSHandler.java:3079)
at org.apache.hadoop.hive.metastore.HMSHandler.drop_table_req(HMSHandler.java:3366)
@zxl-333 - Can you please address this comment: https://github.com/apache/hive/pull/5997#discussion_r2427342639
Can we help to @zxl-333 to make it happen?