Преглед изворни кода

HADOOP-866. Fix 'dfs -get' command to remove existing crc files, if any. Contributed by Milind.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@494253 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting пре 18 година
родитељ
комит
48c8d7ddd6
2 измењених фајлова са 11 додато и 1 уклоњено
  1. 3 0
      CHANGES.txt
  2. 8 1
      src/java/org/apache/hadoop/fs/FileUtil.java

+ 3 - 0
CHANGES.txt

@@ -17,6 +17,9 @@ Trunk (unreleased changes)
  5. HADOOP-864.  Fix 'bin/hadoop -jar' to operate correctly when
     hadoop.tmp.dir does not yet exist.  (omalley via cutting)
 
+ 6. HADOOP-866.  Fix 'dfs -get' command to remove existing crc files,
+    if any.  (Milind Bhandarkar via cutting)
+
 
 Release 0.10.0 - 2007-01-05
 

+ 8 - 1
src/java/org/apache/hadoop/fs/FileUtil.java

@@ -98,7 +98,14 @@ public class FileUtil {
         copyContent(in, out, conf);
       } finally {
         in.close();
-      } 
+      }
+      // if crc copying is disabled, remove the existing crc file if any
+      if (!copyCrc) {
+        Path crcFile = dstFS.getChecksumFile(dst);
+        if (dstFS.exists(crcFile)) {
+          dstFS.deleteRaw(crcFile);
+        }
+      }
     } else {
       throw new IOException(src.toString() + ": No such file or directory");
     }