You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2020/09/21 05:16:10 UTC

[GitHub] [hadoop] NickyYe commented on a change in pull request #2274: HDFS-15557. Log the reason why a storage log file can't be deleted

NickyYe commented on a change in pull request #2274:
URL: https://github.com/apache/hadoop/pull/2274#discussion_r491797152



##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/AtomicFileOutputStream.java
##########
@@ -75,8 +76,13 @@ public void close() throws IOException {
         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

Review comment:
       Fixed. Thanks.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org