okumin commented on code in PR #6006:
URL: https://github.com/apache/hive/pull/6006#discussion_r2390360708
##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/FileUtils.java:
##########
@@ -71,41 +71,19 @@ public boolean accept(Path p) {
}
};
- /**
- * Move a particular file or directory to the trash.
- * @param fs FileSystem to use
- * @param f path of file or directory to move to trash.
- * @param conf configuration object
- * @return true if move successful
- * @throws IOException
- */
- public static boolean moveToTrash(FileSystem fs, Path f, Configuration conf,
boolean purge)
+ public static boolean deleteDir(FileSystem fs, Path f, boolean ifPurge,
Configuration conf)
throws IOException {
- LOG.debug("deleting " + f);
- boolean result;
+ if (!fs.exists(f)) {
+ LOG.warn("The path to delete does not exist: " + f);
+ return true;
+ }
+ if (!ifPurge && moveToTrash(fs, f, conf)) {
+ return true;
+ }
try {
- if (!fs.exists(f)) {
- LOG.warn("The path to moveToTrash does not exist: " + f);
- return true;
- }
- if (purge) {
- LOG.debug("purge is set to true. Not moving to Trash " + f);
- } else {
- result = Trash.moveToAppropriateTrash(fs, f, conf);
- if (result) {
- LOG.trace("Moved to trash: " + f);
- return true;
- }
- }
- } catch (IOException ioe) {
// for whatever failure reason including that trash has lower encryption
zone
// retry with force delete
Review Comment:
I guess moveToTrasn does not return false but throws an IOException in that
case. This is really a guess, based on the original code, and I've not
confirmed it
--
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]