This is an automated email from the ASF dual-hosted git repository. inigoiri pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new ae089f2 HDFS-15557. Log the reason why a storage log file can't be deleted (#2274) ae089f2 is described below commit ae089f2db7244c192135d500240ecdb95c7eb005 Author: Ye Ni <141253+nick...@users.noreply.github.com> AuthorDate: Tue Sep 22 13:23:20 2020 -0700 HDFS-15557. Log the reason why a storage log file can't be deleted (#2274) --- .../java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java index 33f976a..c6003e8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java @@ -22,6 +22,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilterOutputStream; import java.io.IOException; +import java.nio.file.Files; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,8 +76,12 @@ public class AtomicFileOutputStream extends FilterOutputStream { boolean renamed = tmpFile.renameTo(origFile); if (!renamed) { // On windows, renameTo does not replace. - if (origFile.exists() && !origFile.delete()) { - throw new IOException("Could not delete original file " + origFile); + if (origFile.exists()) { + try { + Files.delete(origFile.toPath()); + } catch (IOException e) { + throw new IOException("Could not delete original file " + origFile, e); + } } try { NativeIO.renameTo(tmpFile, origFile); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org