hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r949833 - in /hadoop/hdfs/branches/branch-0.21: ./ src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/ src/java/org/apache/hadoop/hdfs/ src/java/org/apache/hadoop/hdfs/server/namenode/ src/test/hdfs/org/apache/hadoop/hdfs/ src/test/hd...
Date Mon, 31 May 2010 18:57:22 GMT
Author: tomwhite
Date: Mon May 31 18:57:21 2010
New Revision: 949833

URL: http://svn.apache.org/viewvc?rev=949833&view=rev
Log:
Merge -r 949826:949827 from trunk to 0.21 branch. Fixes: HDFS-995

Modified:
    hadoop/hdfs/branches/branch-0.21/CHANGES.txt
    hadoop/hdfs/branches/branch-0.21/src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSClientRetries.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileStatus.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestListPathServlet.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/security/TestPermission.java
    hadoop/hdfs/branches/branch-0.21/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestDataDirs.java

Modified: hadoop/hdfs/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/CHANGES.txt?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.21/CHANGES.txt Mon May 31 18:57:21 2010
@@ -500,6 +500,9 @@ Release 0.21.0 - Unreleased
     HDFS-1126. Change HDFS to depend on Hadoop 'common' artifacts instead
     of 'core'. (tomwhite)
 
+    HDFS-995.  Replace usage of FileStatus#isDir().  (Eli Collins via
+    tomwhite)
+
   OPTIMIZATIONS
 
     HDFS-946. NameNode should not return full path name when lisitng a

Modified: hadoop/hdfs/branches/branch-0.21/src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/contrib/thriftfs/src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java
Mon May 31 18:57:21 2010
@@ -415,7 +415,7 @@ public class HadoopThriftServer extends 
         return new org.apache.hadoop.thriftfs.api.FileStatus(
           stat.getPath().toString(),
           stat.getLen(),
-          stat.isDir(),
+          stat.isDirectory(),
           stat.getReplication(),
           stat.getBlockSize(),
           stat.getModificationTime(),
@@ -448,7 +448,7 @@ public class HadoopThriftServer extends 
           tmp = new org.apache.hadoop.thriftfs.api.FileStatus(
                       stat[i].getPath().toString(),
                       stat[i].getLen(),
-                      stat[i].isDir(),
+                      stat[i].isDirectory(),
                       stat[i].getReplication(),
                       stat[i].getBlockSize(),
                       stat[i].getModificationTime(),

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java (original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java Mon
May 31 18:57:21 2010
@@ -220,7 +220,7 @@ public class HftpFileSystem extends File
 
     public FileStatus[] listStatus(Path f, boolean recur) throws IOException {
       fetchList(f.toUri().getPath(), recur);
-      if (fslist.size() > 0 && (fslist.size() != 1 || fslist.get(0).isDir()))
{
+      if (fslist.size() > 0 && (fslist.size() != 1 || fslist.get(0).isDirectory()))
{
         fslist.remove(0);
       }
       return fslist.toArray(new FileStatus[0]);

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
Mon May 31 18:57:21 2010
@@ -602,9 +602,10 @@ class FSDirectory implements Closeable {
         throw new IOException(error);
       }
       if (dstInode != null) { // Destination exists
+        // It's OK to rename a file to a symlink and vice versa
         if (dstInode.isDirectory() != srcInode.isDirectory()) {
-          error = "Source " + src + " Destination " + dst
-              + " both should be either file or directory";
+          error = "Source " + src + " and destination " + dst
+              + " must both be directories";
           NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: "
               + error);
           throw new IOException(error);

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSClientRetries.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSClientRetries.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSClientRetries.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSClientRetries.java
Mon May 31 18:57:21 2010
@@ -400,7 +400,7 @@ public class TestDFSClientRetries extend
       
       // verify that file exists in FS namespace
       assertTrue(file1 + " should be a file", 
-                  fs.getFileStatus(file1).isDir() == false);
+                  fs.getFileStatus(file1).isFile());
       System.out.println("Path : \"" + file1 + "\"");
       LOG.info("Path : \"" + file1 + "\"");
 

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
Mon May 31 18:57:21 2010
@@ -73,7 +73,7 @@ public class TestDFSShell extends TestCa
   static Path mkdir(FileSystem fs, Path p) throws IOException {
     assertTrue(fs.mkdirs(p));
     assertTrue(fs.exists(p));
-    assertTrue(fs.getFileStatus(p).isDir());
+    assertTrue(fs.getFileStatus(p).isDirectory());
     return p;
   }
 

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUpgradeFromImage.java
Mon May 31 18:57:21 2010
@@ -134,7 +134,7 @@ public class TestDFSUpgradeFromImage ext
     TreeMap<Path, Boolean> fileMap = new TreeMap<Path, Boolean>();
     
     for(FileStatus file : fileArr) {
-      fileMap.put(file.getPath(), Boolean.valueOf(file.isDir()));
+      fileMap.put(file.getPath(), Boolean.valueOf(file.isDirectory()));
     }
     
     for(Iterator<Path> it = fileMap.keySet().iterator(); it.hasNext();) {

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileCreation.java
Mon May 31 18:57:21 2010
@@ -169,9 +169,9 @@ public class TestFileCreation extends ju
       //
       Path path = new Path("/");
       System.out.println("Path : \"" + path.toString() + "\"");
-      System.out.println(fs.getFileStatus(path).isDir()); 
+      System.out.println(fs.getFileStatus(path).isDirectory()); 
       assertTrue("/ should be a directory", 
-                 fs.getFileStatus(path).isDir() == true);
+                 fs.getFileStatus(path).isDirectory());
 
       //
       // Create a directory inside /, then try to overwrite it
@@ -200,7 +200,7 @@ public class TestFileCreation extends ju
 
       // verify that file exists in FS namespace
       assertTrue(file1 + " should be a file", 
-                  fs.getFileStatus(file1).isDir() == false);
+                 fs.getFileStatus(file1).isFile());
       System.out.println("Path : \"" + file1 + "\"");
 
       // write to file
@@ -320,7 +320,7 @@ public class TestFileCreation extends ju
 
       // verify that file exists in FS namespace
       assertTrue(file1 + " should be a file", 
-                  fs.getFileStatus(file1).isDir() == false);
+                 fs.getFileStatus(file1).isFile());
       System.out.println("Path : \"" + file1 + "\"");
 
       // kill the datanode

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileStatus.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileStatus.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileStatus.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestFileStatus.java
Mon May 31 18:57:21 2010
@@ -89,7 +89,7 @@ public class TestFileStatus extends Test
       Path path = new Path("/");
       System.out.println("Path : \"" + path.toString() + "\"");
       assertTrue("/ should be a directory", 
-                 fs.getFileStatus(path).isDir() == true);
+                 fs.getFileStatus(path).isDirectory() == true);
       
       // make sure getFileInfo returns null for files which do not exist
       HdfsFileStatus fileInfo = dfsClient.getFileInfo("/noSuchFile");
@@ -116,7 +116,7 @@ public class TestFileStatus extends Test
       // test getFileStatus on a file
       FileStatus status = fs.getFileStatus(file1);
       assertTrue(file1 + " should be a file", 
-                  status.isDir() == false);
+                  status.isDirectory() == false);
       assertTrue(status.getBlockSize() == blockSize);
       assertTrue(status.getReplication() == 1);
       assertTrue(status.getLen() == fileSize);
@@ -129,7 +129,7 @@ public class TestFileStatus extends Test
       assertEquals(1, stats.length);
       status = stats[0];
       assertTrue(file1 + " should be a file", 
-          status.isDir() == false);
+          status.isDirectory() == false);
       assertTrue(status.getBlockSize() == blockSize);
       assertTrue(status.getReplication() == 1);
       assertTrue(status.getLen() == fileSize);
@@ -141,7 +141,7 @@ public class TestFileStatus extends Test
       status = itor.next();
       assertEquals(stats[0], status);
       assertTrue(file1 + " should be a file", 
-          status.isDir() == false);
+          status.isDirectory() == false);
 
       // test file status on a directory
       Path dir = new Path("/test/mkdirs");
@@ -174,7 +174,7 @@ public class TestFileStatus extends Test
       
       // test getFileStatus on an empty directory
       status = fs.getFileStatus(dir);
-      assertTrue(dir + " should be a directory", status.isDir());
+      assertTrue(dir + " should be a directory", status.isDirectory());
       assertTrue(dir + " should be zero size ", status.getLen() == 0);
       assertEquals(dir.makeQualified(fs.getUri(), 
           fs.getWorkingDirectory()).toString(), 

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestListPathServlet.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestListPathServlet.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestListPathServlet.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestListPathServlet.java
Mon May 31 18:57:21 2010
@@ -114,7 +114,8 @@ public class TestListPathServlet {
     }
     for (FileStatus status : statuslist) {
       System.out.println("status:" + status.getPath().toString() + " type "
-          + (status.isDir() ? "directory" : "file"));
+          + (status.isDirectory() ? "directory" 
+                                  : ( status.isFile() ? "file" : "symlink")));
     }
     for (String file : filelist) {
       boolean found = false;

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java
Mon May 31 18:57:21 2010
@@ -95,7 +95,7 @@ public class TestFileLimit extends TestC
       //
       Path path = new Path("/");
       assertTrue("/ should be a directory", 
-                 fs.getFileStatus(path).isDir() == true);
+                 fs.getFileStatus(path).isDirectory());
       currentNodes = 1;          // root inode
 
       // verify that we can create the specified number of files. We leave

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
Mon May 31 18:57:21 2010
@@ -259,7 +259,7 @@ public class TestOfflineImageViewer exte
   // the output of the ls file from the image processor
   private void compareFiles(FileStatus fs, LsElements elements) {
     assertEquals("directory listed as such",  
-                                        fs.isDir() ? 'd' : '-', elements.dir);
+                 fs.isDirectory() ? 'd' : '-', elements.dir);
     assertEquals("perms string equal", 
                                 fs.getPermission().toString(), elements.perms);
     assertEquals("replication equal", fs.getReplication(), elements.replication);

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/security/TestPermission.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/security/TestPermission.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/security/TestPermission.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/security/TestPermission.java
Mon May 31 18:57:21 2010
@@ -52,7 +52,7 @@ public class TestPermission extends Test
   static FsPermission checkPermission(FileSystem fs,
       String path, FsPermission expected) throws IOException {
     FileStatus s = fs.getFileStatus(new Path(path));
-    LOG.info(s.getPath() + ": " + s.isDir() + " " + s.getPermission()
+    LOG.info(s.getPath() + ": " + s.isDirectory() + " " + s.getPermission()
         + ":" + s.getOwner() + ":" + s.getGroup());
     if (expected != null) {
       assertEquals(expected, s.getPermission());

Modified: hadoop/hdfs/branches/branch-0.21/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestDataDirs.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestDataDirs.java?rev=949833&r1=949832&r2=949833&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestDataDirs.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/unit/org/apache/hadoop/hdfs/server/datanode/TestDataDirs.java
Mon May 31 18:57:21 2010
@@ -43,7 +43,7 @@ public class TestDataDirs {
     FsPermission badPerm = new FsPermission("000");
     FileStatus stat = make(stub(FileStatus.class)
         .returning(normalPerm, normalPerm, badPerm).from.getPermission());
-    when(stat.isDir()).thenReturn(true);
+    when(stat.isDirectory()).thenReturn(true);
     LocalFileSystem fs = make(stub(LocalFileSystem.class)
         .returning(stat).from.getFileStatus(any(Path.class)));
     when(fs.pathToFile(any(Path.class))).thenReturn(localDir);



Mime
View raw message