瀏覽代碼

If close() fails, then abandon the file, so that any leases are
cleared and other task may attempt to create it.


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@390717 13f79535-47bb-0310-9956-ffa450edef68

Doug Cutting 19 年之前
父節點
當前提交
09d93f190f
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 6 - 1
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -809,7 +809,12 @@ class DFSClient implements FSConstants {
 
             flush();
             if (filePos == 0 || bytesWrittenToBlock != 0) {
-              endBlock();
+              try {
+                endBlock();
+              } catch (IOException e) {
+                namenode.abandonFileInProgress(src.toString());
+                throw e;
+              }
             }
 
             backupStream.close();