hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-29106: When drop a table, there is no need to verify the directo…

Open zxl-333 opened this issue 4 months ago • 10 comments

…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?

zxl-333 avatar Jul 28 '25 11:07 zxl-333

@deniskuzZ Please review the code.Thanks

zxl-333 avatar Jul 28 '25 11:07 zxl-333

@ayushtkn Please help review the code.Thank you.

zxl-333 avatar Jul 30 '25 09:07 zxl-333

@deniskuzZ please check again

zxl-333 avatar Sep 12 '25 03:09 zxl-333

@saihemanth-cloudera please check again

zxl-333 avatar Sep 23 '25 03:09 zxl-333

@deniskuzZ I can't see the error message indicating the compilation failure.

zxl-333 avatar Oct 09 '25 02:10 zxl-333

@deniskuzZ I can't see the error message indicating the compilation failure.

@saihemanth-cloudera

zxl-333 avatar Oct 10 '25 07:10 zxl-333

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)

deniskuzZ avatar Oct 23 '25 13:10 deniskuzZ

@zxl-333 - Can you please address this comment: https://github.com/apache/hive/pull/5997#discussion_r2427342639

saihemanth-cloudera avatar Oct 23 '25 16:10 saihemanth-cloudera

Can we help to @zxl-333 to make it happen?

aturoczy avatar Dec 11 '25 23:12 aturoczy