hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r634500 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FsShell.java src/test/org/apache/hadoop/dfs/TestDFSShell.java
Date Fri, 07 Mar 2008 01:56:12 GMT
Author: rangadi
Date: Thu Mar  6 17:56:09 2008
New Revision: 634500

URL: http://svn.apache.org/viewvc?rev=634500&view=rev
Log:
HADOOP-2938. A few fs commands did not glob paths. (Tsz Wo (Nicholas), SZE via dhruba)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=634500&r1=634499&r2=634500&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar  6 17:56:09 2008
@@ -149,6 +149,9 @@
     HADOOP-2934. The namenode was encountreing a NPE while loading
     leases from the fsimage. Fixed. (dhruba)
 
+    HADOOP-2938. Some fs commands did not glob paths.
+    (Tsz Wo (Nicholas), SZE via rangadi)
+    
 Release 0.16.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=634500&r1=634499&r2=634500&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FsShell.java Thu Mar  6 17:56:09 2008
@@ -339,7 +339,7 @@
         }
         printToStdout(srcFs.open(p));
       }
-    }.process(srcPattern, getSrcFileSystem(srcPattern, verifyChecksum));
+    }.globAndProcess(srcPattern, getSrcFileSystem(srcPattern, verifyChecksum));
   }
 
   private class TextRecordInputStream extends InputStream {
@@ -407,7 +407,7 @@
         }
         printToStdout(forMagic(p, srcFs));
       }
-    }.process(srcPattern, srcPattern.getFileSystem(getConf()));
+    }.globAndProcess(srcPattern, srcPattern.getFileSystem(getConf()));
   }
 
   /**
@@ -1033,7 +1033,7 @@
       void process(Path p, FileSystem srcFs) throws IOException {
         delete(p, srcFs, recursive);
       }
-    }.process(srcPattern, srcPattern.getFileSystem(getConf()));
+    }.globAndProcess(srcPattern, srcPattern.getFileSystem(getConf()));
   }
     
   /* delete a file */
@@ -1843,7 +1843,7 @@
   private abstract class DelayedExceptionThrowing {
     abstract void process(Path p, FileSystem srcFs) throws IOException;
 
-    final void processSrc(Path srcPattern, FileSystem srcFs
+    final void globAndProcess(Path srcPattern, FileSystem srcFs
         ) throws IOException {
       List<IOException> exceptions = new ArrayList<IOException>();
       for(Path p : srcFs.globPaths(srcPattern))

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java?rev=634500&r1=634499&r2=634500&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java Thu Mar  6 17:56:09
2008
@@ -737,6 +737,29 @@
       writeFile(fileSys, myFile2);
       assertTrue(fileSys.exists(myFile2));
 
+      // Verify that rm with a pattern
+      {
+        String[] args = new String[2];
+        args[0] = "-rm";
+        args[1] = "/test/mkdirs/myFile*";
+        int val = -1;
+        try {
+          val = shell.run(args);
+        } catch (Exception e) {
+          System.err.println("Exception raised from DFSShell.run " +
+                             e.getLocalizedMessage()); 
+        }
+        assertTrue(val == 0);
+        assertFalse(fileSys.exists(myFile));
+        assertFalse(fileSys.exists(myFile2));
+
+        //re-create the files for other tests
+        writeFile(fileSys, myFile);
+        assertTrue(fileSys.exists(myFile));
+        writeFile(fileSys, myFile2);
+        assertTrue(fileSys.exists(myFile2));
+      }
+
       // Verify that we can read the file
       {
         String[] args = new String[3];



Mime
View raw message