hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aihu...@apache.org
Subject hive git commit: HIVE-17149: Hdfs directory is not cleared if partition creation failed on HMS (Barna Zsombor Klara, reviewed by Aihua Xu)
Date Mon, 24 Jul 2017 23:21:44 GMT
Repository: hive
Updated Branches:
  refs/heads/master a282e5d94 -> 549ac12dd


HIVE-17149: Hdfs directory is not cleared if partition creation failed on HMS (Barna Zsombor
Klara, reviewed by Aihua Xu)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/549ac12d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/549ac12d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/549ac12d

Branch: refs/heads/master
Commit: 549ac12dd3d41215aeb31d6d247a1c86f2ed85de
Parents: a282e5d
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Mon Jul 24 16:21:07 2017 -0700
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Mon Jul 24 16:21:07 2017 -0700

----------------------------------------------------------------------
 ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/549ac12d/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 02cea7c..d661f10 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -1781,6 +1781,16 @@ public class Hive {
           // In that case, we want to retry with alterPartition.
           LOG.debug("Caught AlreadyExistsException, trying to alter partition instead");
           setStatsPropAndAlterPartition(hasFollowingStatsTask, tbl, newTPart);
+        } catch (Exception e) {
+          try {
+            final FileSystem newPathFileSystem = newPartPath.getFileSystem(this.getConf());
+            boolean isAutoPurge = "true".equalsIgnoreCase(tbl.getProperty("auto.purge"));
+            final FileStatus status = newPathFileSystem.getFileStatus(newPartPath);
+            Hive.trashFiles(newPathFileSystem, new FileStatus[] {status}, this.getConf(),
isAutoPurge);
+          } catch (IOException io) {
+            LOG.error("Could not delete partition directory contents after failed partition
creation: ", io);
+          }
+          throw e;
         }
       } else {
         setStatsPropAndAlterPartition(hasFollowingStatsTask, tbl, newTPart);


Mime
View raw message