hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r686867 - in /hadoop/core/trunk: CHANGES.txt src/test/org/apache/hadoop/fs/TestCopyFiles.java src/tools/org/apache/hadoop/tools/DistCp.java
Date Mon, 18 Aug 2008 20:54:32 GMT
Author: cdouglas
Date: Mon Aug 18 13:54:31 2008
New Revision: 686867

URL: http://svn.apache.org/viewvc?rev=686867&view=rev
Log:
HADOOP-3957. Fix javac warnings in DistCp and TestCopyFiles. Contributed by Tsz Wo (Nicholas),
SZE.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
    hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=686867&r1=686866&r2=686867&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Mon Aug 18 13:54:31 2008
@@ -332,6 +332,9 @@
     HADOOP-3962. Shell command "fs -count" should support paths with different
     file systems. (Tsz Wo (Nicholas), SZE via mahadev)
 
+    HADOOP-3957. Fix javac warnings in DistCp and TestCopyFiles. (Tsz Wo
+    (Nicholas), SZE via cdouglas)
+
 Release 0.18.0 - 2008-08-19
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java?rev=686867&r1=686866&r2=686867&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java Mon Aug 18 13:54:31
2008
@@ -54,7 +54,7 @@
     ((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.OFF);
     ((Log4JLogger)FSNamesystem.LOG).getLogger().setLevel(Level.OFF);
     ((Log4JLogger)DistCp.LOG).getLogger().setLevel(Level.ALL);
-    ((Log4JLogger)FileSystem.LOG).getLogger().setLevel(Level.ALL);
+    //((Log4JLogger)FileSystem.LOG).getLogger().setLevel(Level.ALL);
   }
   
   static final URI LOCAL_FS = URI.create("file:///");
@@ -146,18 +146,9 @@
     return createFile(root, fs, -1);
   }
 
-  /** Same as checkFiles(fsname, topdir, files, false); */
-  private static boolean checkFiles(String fsname, String topdir, MyFile[] files)
-    throws IOException {
-    return checkFiles(fsname, topdir, files, false);
-  }
-
-  /** check if the files have been copied correctly. */
-  private static boolean checkFiles(String fsname, String topdir, MyFile[] files,
-      boolean existingOnly) throws IOException {
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.getNamed(fsname, conf);
-    return checkFiles(fs, topdir, files, existingOnly); 
+  private static boolean checkFiles(FileSystem fs, String topdir, MyFile[] files
+      ) throws IOException {
+    return checkFiles(fs, topdir, files, false);    
   }
 
   private static boolean checkFiles(FileSystem fs, String topdir, MyFile[] files,
@@ -193,12 +184,10 @@
     return true;
   }
 
-  private static void updateFiles(String fsname, String topdir, MyFile[] files,
+  private static void updateFiles(FileSystem fs, String topdir, MyFile[] files,
         int nupdate) throws IOException {
     assert nupdate <= NFILES;
 
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.getNamed(fsname, conf);
     Path root = new Path(topdir);
 
     for (int idx = 0; idx < nupdate; ++idx) {
@@ -215,14 +204,12 @@
     }
   }
 
-  private static FileStatus[] getFileStatus(String namenode,
+  private static FileStatus[] getFileStatus(FileSystem fs,
       String topdir, MyFile[] files) throws IOException {
-    return getFileStatus(namenode, topdir, files, false);
+    return getFileStatus(fs, topdir, files, false);
   }
-  private static FileStatus[] getFileStatus(String namenode,
+  private static FileStatus[] getFileStatus(FileSystem fs,
       String topdir, MyFile[] files, boolean existingOnly) throws IOException {
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.getNamed(namenode, conf);
     Path root = new Path(topdir);
     List<FileStatus> statuses = new ArrayList<FileStatus>();
     for (int idx = 0; idx < NFILES; ++idx) {
@@ -237,11 +224,8 @@
     return statuses.toArray(new FileStatus[statuses.size()]);
   }
 
-  private static boolean checkUpdate(FileStatus[] old, String namenode,
+  private static boolean checkUpdate(FileSystem fs, FileStatus[] old,
       String topdir, MyFile[] upd, final int nupdate) throws IOException {
-
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.getNamed(namenode, conf);
     Path root = new Path(topdir);
 
     // overwrote updated files
@@ -264,24 +248,22 @@
   }
 
   /** delete directory and everything underneath it.*/
-  private static void deldir(String fsname, String topdir)
-    throws IOException {
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.getNamed(fsname, conf);
-    Path root = new Path(topdir);
-    fs.delete(root, true);
+  private static void deldir(FileSystem fs, String topdir) throws IOException {
+    fs.delete(new Path(topdir), true);
   }
   
   /** copy files from local file system to local file system */
   public void testCopyFromLocalToLocal() throws Exception {
+    Configuration conf = new Configuration();
+    FileSystem localfs = FileSystem.get(LOCAL_FS, conf);
     MyFile[] files = createFiles(LOCAL_FS, TEST_ROOT_DIR+"/srcdat");
     ToolRunner.run(new DistCp(new Configuration()),
                            new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                                          "file:///"+TEST_ROOT_DIR+"/destdat"});
     assertTrue("Source and destination directories do not match.",
-               checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
-    deldir("file:///", TEST_ROOT_DIR+"/destdat");
-    deldir("file:///", TEST_ROOT_DIR+"/srcdat");
+               checkFiles(localfs, TEST_ROOT_DIR+"/destdat", files));
+    deldir(localfs, TEST_ROOT_DIR+"/destdat");
+    deldir(localfs, TEST_ROOT_DIR+"/srcdat");
   }
   
   /** copy files from dfs file system to dfs file system */
@@ -291,6 +273,7 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 2, true, null);
+      final FileSystem hdfs = cluster.getFileSystem();
       namenode = FileSystem.getDefaultUri(conf).toString();
       if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
@@ -300,13 +283,13 @@
                                          namenode+"/srcdat",
                                          namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(namenode, "/destdat", files));
+                   checkFiles(hdfs, "/destdat", files));
         FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
                    fs.exists(new Path(namenode+"/logs")));
-        deldir(namenode, "/destdat");
-        deldir(namenode, "/srcdat");
-        deldir(namenode, "/logs");
+        deldir(hdfs, "/destdat");
+        deldir(hdfs, "/srcdat");
+        deldir(hdfs, "/logs");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -315,12 +298,12 @@
   
   /** copy files from local file system to dfs file system */
   public void testCopyFromLocalToDfs() throws Exception {
-    String namenode = null;
     MiniDFSCluster cluster = null;
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = FileSystem.getDefaultUri(conf).toString();
+      final FileSystem hdfs = cluster.getFileSystem();
+      final String namenode = hdfs.getUri().toString();
       if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(LOCAL_FS, TEST_ROOT_DIR+"/srcdat");
         ToolRunner.run(new DistCp(conf), new String[] {
@@ -329,13 +312,12 @@
                                          "file:///"+TEST_ROOT_DIR+"/srcdat",
                                          namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(namenode, "/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
+                   checkFiles(cluster.getFileSystem(), "/destdat", files));
         assertTrue("Log directory does not exist.",
-                    fs.exists(new Path(namenode+"/logs")));
-        deldir(namenode, "/destdat");
-        deldir(namenode, "/logs");
-        deldir("file:///", TEST_ROOT_DIR+"/srcdat");
+                    hdfs.exists(new Path(namenode+"/logs")));
+        deldir(hdfs, "/destdat");
+        deldir(hdfs, "/logs");
+        deldir(FileSystem.get(LOCAL_FS, conf), TEST_ROOT_DIR+"/srcdat");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -344,12 +326,13 @@
 
   /** copy files from dfs file system to local file system */
   public void testCopyFromDfsToLocal() throws Exception {
-    String namenode = null;
     MiniDFSCluster cluster = null;
     try {
       Configuration conf = new Configuration();
+      final FileSystem localfs = FileSystem.get(LOCAL_FS, conf);
       cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = FileSystem.getDefaultUri(conf).toString();
+      final FileSystem hdfs = cluster.getFileSystem();
+      final String namenode = FileSystem.getDefaultUri(conf).toString();
       if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
         ToolRunner.run(new DistCp(conf), new String[] {
@@ -358,13 +341,12 @@
                                          namenode+"/srcdat",
                                          "file:///"+TEST_ROOT_DIR+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
+                   checkFiles(localfs, TEST_ROOT_DIR+"/destdat", files));
         assertTrue("Log directory does not exist.",
-                    fs.exists(new Path("/logs")));
-        deldir("file:///", TEST_ROOT_DIR+"/destdat");
-        deldir(namenode, "/logs");
-        deldir(namenode, "/srcdat");
+                    hdfs.exists(new Path("/logs")));
+        deldir(localfs, TEST_ROOT_DIR+"/destdat");
+        deldir(hdfs, "/logs");
+        deldir(hdfs, "/srcdat");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -372,12 +354,12 @@
   }
 
   public void testCopyDfsToDfsUpdateOverwrite() throws Exception {
-    String namenode = null;
     MiniDFSCluster cluster = null;
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 2, true, null);
-      namenode = FileSystem.getDefaultUri(conf).toString();
+      final FileSystem hdfs = cluster.getFileSystem();
+      final String namenode = hdfs.getUri().toString();
       if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
         ToolRunner.run(new DistCp(conf), new String[] {
@@ -387,15 +369,15 @@
                                          namenode+"/srcdat",
                                          namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(namenode, "/destdat", files));
+                   checkFiles(hdfs, "/destdat", files));
         FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
                     fs.exists(new Path(namenode+"/logs")));
 
-        FileStatus[] dchkpoint = getFileStatus(namenode, "/destdat", files);
+        FileStatus[] dchkpoint = getFileStatus(hdfs, "/destdat", files);
         final int nupdate = NFILES>>2;
-        updateFiles(namenode, "/srcdat", files, nupdate);
-        deldir(namenode, "/logs");
+        updateFiles(cluster.getFileSystem(), "/srcdat", files, nupdate);
+        deldir(hdfs, "/logs");
 
         ToolRunner.run(new DistCp(conf), new String[] {
                                          "-p",
@@ -405,11 +387,11 @@
                                          namenode+"/srcdat",
                                          namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(namenode, "/destdat", files));
+                   checkFiles(hdfs, "/destdat", files));
         assertTrue("Update failed to replicate all changes in src",
-                 checkUpdate(dchkpoint, namenode, "/destdat", files, nupdate));
+                 checkUpdate(hdfs, dchkpoint, "/destdat", files, nupdate));
 
-        deldir(namenode, "/logs");
+        deldir(hdfs, "/logs");
         ToolRunner.run(new DistCp(conf), new String[] {
                                          "-p",
                                          "-overwrite",
@@ -418,13 +400,13 @@
                                          namenode+"/srcdat",
                                          namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(namenode, "/destdat", files));
+                   checkFiles(hdfs, "/destdat", files));
         assertTrue("-overwrite didn't.",
-                 checkUpdate(dchkpoint, namenode, "/destdat", files, NFILES));
+                 checkUpdate(hdfs, dchkpoint, "/destdat", files, NFILES));
 
-        deldir(namenode, "/destdat");
-        deldir(namenode, "/srcdat");
-        deldir(namenode, "/logs");
+        deldir(hdfs, "/destdat");
+        deldir(hdfs, "/srcdat");
+        deldir(hdfs, "/logs");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -432,13 +414,14 @@
   }
 
   public void testCopyDuplication() throws Exception {
+    final FileSystem localfs = FileSystem.get(LOCAL_FS, new Configuration());
     try {    
-      MyFile[] files = createFiles(LOCAL_FS, TEST_ROOT_DIR+"/srcdat");
+      MyFile[] files = createFiles(localfs, TEST_ROOT_DIR+"/srcdat");
       ToolRunner.run(new DistCp(new Configuration()),
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                         "file:///"+TEST_ROOT_DIR+"/src2/srcdat"});
       assertTrue("Source and destination directories do not match.",
-                 checkFiles("file:///", TEST_ROOT_DIR+"/src2/srcdat", files));
+                 checkFiles(localfs, TEST_ROOT_DIR+"/src2/srcdat", files));
   
       assertEquals(DistCp.DuplicationException.ERROR_CODE,
           ToolRunner.run(new DistCp(new Configuration()),
@@ -447,9 +430,9 @@
                         "file:///"+TEST_ROOT_DIR+"/destdat",}));
     }
     finally {
-      deldir("file:///", TEST_ROOT_DIR+"/destdat");
-      deldir("file:///", TEST_ROOT_DIR+"/srcdat");
-      deldir("file:///", TEST_ROOT_DIR+"/src2");
+      deldir(localfs, TEST_ROOT_DIR+"/destdat");
+      deldir(localfs, TEST_ROOT_DIR+"/srcdat");
+      deldir(localfs, TEST_ROOT_DIR+"/src2");
     }
   }
 
@@ -463,7 +446,7 @@
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                         "file:///"+TEST_ROOT_DIR+"/destdat"});
       assertTrue("Source and destination directories do not match.",
-                 checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
+                 checkFiles(fs, TEST_ROOT_DIR+"/destdat", files));
       
       //copy a single file
       String fname = files[0].getName();
@@ -473,9 +456,9 @@
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat/"+fname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"+fname});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files));     
+          checkFiles(fs, TEST_ROOT_DIR+"/dest2", files));     
       //copy single file to existing dir
-      deldir("file:///", TEST_ROOT_DIR+"/dest2");
+      deldir(fs, TEST_ROOT_DIR+"/dest2");
       fs.mkdirs(new Path(TEST_ROOT_DIR+"/dest2"));
       MyFile[] files2 = {createFile(root, fs, 0)};
       String sname = files2[0].getName();
@@ -484,20 +467,20 @@
                         "file:///"+TEST_ROOT_DIR+"/srcdat/"+sname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files2));     
-      updateFiles("file:///", TEST_ROOT_DIR+"/srcdat", files2, 1);
+          checkFiles(fs, TEST_ROOT_DIR+"/dest2", files2));     
+      updateFiles(fs, TEST_ROOT_DIR+"/srcdat", files2, 1);
       //copy single file to existing dir w/ dst name conflict
       ToolRunner.run(new DistCp(new Configuration()),
           new String[] {"-update",
                         "file:///"+TEST_ROOT_DIR+"/srcdat/"+sname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files2));     
+          checkFiles(fs, TEST_ROOT_DIR+"/dest2", files2));     
     }
     finally {
-      deldir("file:///", TEST_ROOT_DIR+"/destdat");
-      deldir("file:///", TEST_ROOT_DIR+"/dest2");
-      deldir("file:///", TEST_ROOT_DIR+"/srcdat");
+      deldir(fs, TEST_ROOT_DIR+"/destdat");
+      deldir(fs, TEST_ROOT_DIR+"/dest2");
+      deldir(fs, TEST_ROOT_DIR+"/srcdat");
     }
   }
 
@@ -511,45 +494,45 @@
 
       {//test preserving user
         MyFile[] files = createFiles(URI.create(nnUri), "/srcdat");
-        FileStatus[] srcstat = getFileStatus(nnUri, "/srcdat", files);
+        FileStatus[] srcstat = getFileStatus(fs, "/srcdat", files);
         for(int i = 0; i < srcstat.length; i++) {
           fs.setOwner(srcstat[i].getPath(), "u" + i, null);
         }
         ToolRunner.run(new DistCp(conf),
             new String[]{"-pu", nnUri+"/srcdat", nnUri+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(nnUri, "/destdat", files));
+                   checkFiles(fs, "/destdat", files));
         
-        FileStatus[] dststat = getFileStatus(nnUri, "/destdat", files);
+        FileStatus[] dststat = getFileStatus(fs, "/destdat", files);
         for(int i = 0; i < dststat.length; i++) {
           assertEquals("i=" + i, "u" + i, dststat[i].getOwner());
         }
-        deldir(nnUri, "/destdat");
-        deldir(nnUri, "/srcdat");
+        deldir(fs, "/destdat");
+        deldir(fs, "/srcdat");
       }
 
       {//test preserving group
         MyFile[] files = createFiles(URI.create(nnUri), "/srcdat");
-        FileStatus[] srcstat = getFileStatus(nnUri, "/srcdat", files);
+        FileStatus[] srcstat = getFileStatus(fs, "/srcdat", files);
         for(int i = 0; i < srcstat.length; i++) {
           fs.setOwner(srcstat[i].getPath(), null, "g" + i);
         }
         ToolRunner.run(new DistCp(conf),
             new String[]{"-pg", nnUri+"/srcdat", nnUri+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(nnUri, "/destdat", files));
+                   checkFiles(fs, "/destdat", files));
         
-        FileStatus[] dststat = getFileStatus(nnUri, "/destdat", files);
+        FileStatus[] dststat = getFileStatus(fs, "/destdat", files);
         for(int i = 0; i < dststat.length; i++) {
           assertEquals("i=" + i, "g" + i, dststat[i].getGroup());
         }
-        deldir(nnUri, "/destdat");
-        deldir(nnUri, "/srcdat");
+        deldir(fs, "/destdat");
+        deldir(fs, "/srcdat");
       }
 
       {//test preserving mode
         MyFile[] files = createFiles(URI.create(nnUri), "/srcdat");
-        FileStatus[] srcstat = getFileStatus(nnUri, "/srcdat", files);
+        FileStatus[] srcstat = getFileStatus(fs, "/srcdat", files);
         FsPermission[] permissions = new FsPermission[srcstat.length];
         for(int i = 0; i < srcstat.length; i++) {
           permissions[i] = new FsPermission((short)(i & 0666));
@@ -559,14 +542,14 @@
         ToolRunner.run(new DistCp(conf),
             new String[]{"-pp", nnUri+"/srcdat", nnUri+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles(nnUri, "/destdat", files));
+                   checkFiles(fs, "/destdat", files));
   
-        FileStatus[] dststat = getFileStatus(nnUri, "/destdat", files);
+        FileStatus[] dststat = getFileStatus(fs, "/destdat", files);
         for(int i = 0; i < dststat.length; i++) {
           assertEquals("i=" + i, permissions[i], dststat[i].getPermission());
         }
-        deldir(nnUri, "/destdat");
-        deldir(nnUri, "/srcdat");
+        deldir(fs, "/destdat");
+        deldir(fs, "/srcdat");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -597,13 +580,13 @@
                         namenode+"/srcdat",
                         namenode+"/destdat"});
       assertTrue("Source and destination directories do not match.",
-                 checkFiles(namenode, "/destdat", files));
+                 checkFiles(fs, "/destdat", files));
       FileStatus[] logs = fs.listStatus(new Path(namenode+"/logs"));
       // rare case where splits are exact, logs.length can be 4
       assertTrue("Unexpected map count", logs.length == 5 || logs.length == 4);
 
-      deldir(namenode, "/destdat");
-      deldir(namenode, "/logs");
+      deldir(fs, "/destdat");
+      deldir(fs, "/logs");
       ToolRunner.run(new DistCp(job),
           new String[] {"-m", "1",
                         "-log",
@@ -640,10 +623,10 @@
         ToolRunner.run(distcp,
             new String[]{"-filelimit", ""+filelimit, nnUri+srcrootdir, nnUri+dstrootdir});
         
-        FileStatus[] dststat = getFileStatus(nnUri, dstrootdir, files, true);
+        FileStatus[] dststat = getFileStatus(fs, dstrootdir, files, true);
         assertEquals(filelimit, dststat.length);
-        deldir(nnUri, dstrootdir);
-        deldir(nnUri, srcrootdir);
+        deldir(fs, dstrootdir);
+        deldir(fs, srcrootdir);
       }
 
       {//test -sizelimit
@@ -657,8 +640,8 @@
         ContentSummary summary = fs.getContentSummary(dstrootpath);
         System.out.println("summary=" + summary);
         assertTrue(summary.getLength() <= sizelimit);
-        deldir(nnUri, dstrootdir);
-        deldir(nnUri, srcrootdir);
+        deldir(fs, dstrootdir);
+        deldir(fs, srcrootdir);
       }
 
       {//test update
@@ -681,19 +664,19 @@
         for(int i = 0; i <= parts; i++) {
           ToolRunner.run(distcp, args);
         
-          FileStatus[] dststat = getFileStatus(nnUri, dstrootdir, srcs, true);
+          FileStatus[] dststat = getFileStatus(fs, dstrootdir, srcs, true);
           System.out.println(i + ") dststat.length=" + dststat.length);
           assertTrue(dststat.length - dstfilecount <= filelimit);
           ContentSummary summary = fs.getContentSummary(dstrootpath);
           System.out.println(i + ") summary.getLength()=" + summary.getLength());
           assertTrue(summary.getLength() - dstsize <= sizelimit);
-          assertTrue(checkFiles(nnUri, dstrootdir, srcs, true));
+          assertTrue(checkFiles(fs, dstrootdir, srcs, true));
           dstfilecount = dststat.length;
           dstsize = summary.getLength();
         }
 
-        deldir(nnUri, dstrootdir);
-        deldir(nnUri, srcrootdir);
+        deldir(fs, dstrootdir);
+        deldir(fs, srcrootdir);
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }

Modified: hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java?rev=686867&r1=686866&r2=686867&view=diff
==============================================================================
--- hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java (original)
+++ hadoop/core/trunk/src/tools/org/apache/hadoop/tools/DistCp.java Mon Aug 18 13:54:31 2008
@@ -299,7 +299,7 @@
    * FSCopyFilesMapper: The mapper for copying files between FileSystems.
    */
   static class CopyFilesMapper
-      implements Mapper<LongWritable, FilePair, WritableComparable, Text> {
+      implements Mapper<LongWritable, FilePair, WritableComparable<?>, Text>
{
     // config
     private int sizeBuf = 128 * 1024;
     private FileSystem destFileSys = null;
@@ -360,7 +360,7 @@
      * @param reporter
      */
     private void copy(FileStatus srcstat, Path relativedst,
-        OutputCollector<WritableComparable, Text> outc, Reporter reporter)
+        OutputCollector<WritableComparable<?>, Text> outc, Reporter reporter)
         throws IOException {
       Path absdst = new Path(destPath, relativedst);
       int totfiles = job.getInt(SRC_COUNT_LABEL, -1);
@@ -520,7 +520,7 @@
      */
     public void map(LongWritable key,
                     FilePair value,
-                    OutputCollector<WritableComparable, Text> out,
+                    OutputCollector<WritableComparable<?>, Text> out,
                     Reporter reporter) throws IOException {
       FileStatus srcstat = value.input;
       Path dstpath = new Path(value.output);



Mime
View raw message