hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1037961 - in /hadoop/hdfs/trunk: ./ src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/hdfs/ src/java/org/apache/hadoop/hdfs/server/datanode/ src/test/hdfs/org/apache/hadoop/fs/ src/test/hdfs/org/apache/hadoop/hdfs/ src/test/hdfs/or...
Date Tue, 23 Nov 2010 01:49:59 GMT
Author: eli
Date: Tue Nov 23 01:49:59 2010
New Revision: 1037961

URL: http://svn.apache.org/viewvc?rev=1037961&view=rev
Log:
HDFS-1513. Fix a number of warnings. Contributed by Eli Collins

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/fs/TestGlobPaths.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLocalDFS.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestModTime.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockTokenWithDFS.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestStreamFile.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Nov 23 01:49:59 2010
@@ -226,7 +226,9 @@ Release 0.22.0 - Unreleased
     blocks are corrupt. (Patrick Kling via hairong)
 
     HDFS-259. Remove intentionally corrupt 0.13 directory layout creation.
-    (Todd Lipcon via eli).
+    (Todd Lipcon via eli)
+
+    HDFS-1513. Fix a number of warnings. (eli)
 
   OPTIMIZATIONS
 

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java Tue Nov 23 01:49:59 2010
@@ -319,7 +319,7 @@ public class Hdfs extends AbstractFileSy
   @Override
   public void renameInternal(Path src, Path dst) 
     throws IOException, UnresolvedLinkException {
-    dfs.rename(getUriPath(src), getUriPath(dst));
+    dfs.rename(getUriPath(src), getUriPath(dst), Options.Rename.NONE);
   }
 
   @Override

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java Tue Nov 23
01:49:59 2010
@@ -183,7 +183,7 @@ public class DistributedFileSystem exten
   /** {@inheritDoc} */
   @Override
   public Path getHomeDirectory() {
-    return new Path("/user/" + dfs.ugi.getShortUserName()).makeQualified(this);
+    return makeQualified(new Path("/user/" + dfs.ugi.getShortUserName()));
   }
 
   private String getPathName(Path file) {

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java Tue Nov 23 01:49:59
2010
@@ -353,13 +353,13 @@ public class HftpFileSystem extends File
               Long.valueOf(attrs.getValue("blocksize")).longValue(),
               modif, atime, FsPermission.valueOf(attrs.getValue("permission")),
               attrs.getValue("owner"), attrs.getValue("group"),
-              new Path(getUri().toString(), attrs.getValue("path"))
-                .makeQualified(HftpFileSystem.this))
+              HftpFileSystem.this.makeQualified(
+                  new Path(getUri().toString(), attrs.getValue("path"))))
         : new FileStatus(0L, true, 0, 0L,
               modif, atime, FsPermission.valueOf(attrs.getValue("permission")),
               attrs.getValue("owner"), attrs.getValue("group"),
-              new Path(getUri().toString(), attrs.getValue("path"))
-                .makeQualified(HftpFileSystem.this));
+              HftpFileSystem.this.makeQualified(
+                  new Path(getUri().toString(), attrs.getValue("path"))));
       fslist.add(fs);
     }
 

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java Tue
Nov 23 01:49:59 2010
@@ -33,7 +33,6 @@ import java.util.LinkedList;
 import java.util.zip.Checksum;
 
 import org.apache.commons.logging.Log;
-import org.apache.hadoop.fs.FSInputChecker;
 import org.apache.hadoop.fs.FSOutputSummer;
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
@@ -695,6 +694,17 @@ class BlockReceiver implements java.io.C
   }
 
   /**
+   * Convert a checksum byte array to a long
+   */
+  static private long checksum2long(byte[] checksum) {
+    long crc = 0L;
+    for(int i=0; i<checksum.length; i++) {
+      crc |= (0xffL&(long)checksum[i])<<((checksum.length-i-1)*8);
+    }
+    return crc;
+  }
+
+  /**
    * reads in the partial crc chunk and computes checksum
    * of pre-existing data in partial chunk.
    */
@@ -735,11 +745,11 @@ class BlockReceiver implements java.io.C
 
     // paranoia! verify that the pre-computed crc matches what we
     // recalculated just now
-    if (partialCrc.getValue() != FSInputChecker.checksum2long(crcbuf)) {
+    if (partialCrc.getValue() != checksum2long(crcbuf)) {
       String msg = "Partial CRC " + partialCrc.getValue() +
                    " does not match value computed the " +
                    " last time file was closed " +
-                   FSInputChecker.checksum2long(crcbuf);
+                   checksum2long(crcbuf);
       throw new IOException(msg);
     }
   }

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/fs/TestGlobPaths.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/fs/TestGlobPaths.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/fs/TestGlobPaths.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/fs/TestGlobPaths.java Tue Nov 23 01:49:59
2010
@@ -394,7 +394,7 @@ public class TestGlobPaths extends TestC
   private Path[] prepareTesting(String pattern, String[] files)
     throws IOException {
     for(int i=0; i<Math.min(NUM_OF_PATHS, files.length); i++) {
-      path[i] = new Path(files[i]).makeQualified(fs);
+      path[i] = fs.makeQualified(new Path(files[i]));
       if (!fs.mkdirs(path[i])) {
         throw new IOException("Mkdirs failed to create " + path[i].toString());
       }
@@ -403,7 +403,8 @@ public class TestGlobPaths extends TestC
     Path[] globResults = FileUtil.stat2Paths(fs.globStatus(patternPath),
                                              patternPath);
     for(int i=0; i<globResults.length; i++) {
-      globResults[i] = globResults[i].makeQualified(fs);
+      globResults[i] = 
+        globResults[i].makeQualified(fs.getUri(), fs.getWorkingDirectory());
     }
     return globResults;
   }
@@ -411,7 +412,7 @@ public class TestGlobPaths extends TestC
   private Path[] prepareTesting(String pattern, String[] files,
       PathFilter filter) throws IOException {
     for(int i=0; i<Math.min(NUM_OF_PATHS, files.length); i++) {
-      path[i] = new Path(files[i]).makeQualified(fs);
+      path[i] = fs.makeQualified(new Path(files[i]));
       if (!fs.mkdirs(path[i])) {
         throw new IOException("Mkdirs failed to create " + path[i].toString());
       }
@@ -420,7 +421,8 @@ public class TestGlobPaths extends TestC
     Path[] globResults = FileUtil.stat2Paths(fs.globStatus(patternPath, filter),
                                              patternPath);
     for(int i=0; i<globResults.length; i++) {
-      globResults[i] = globResults[i].makeQualified(fs);
+      globResults[i] = 
+        globResults[i].makeQualified(fs.getUri(), fs.getWorkingDirectory());
     }
     return globResults;
   }

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLocalDFS.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLocalDFS.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLocalDFS.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLocalDFS.java Tue Nov 23 01:49:59
2010
@@ -82,8 +82,8 @@ public class TestLocalDFS extends TestCa
                                     file1.toString()));
 
       // test home directory
-      Path home = new Path("/user/" + getUserName(fileSys))
-        .makeQualified(fileSys);
+      Path home = 
+        fileSys.makeQualified(new Path("/user/" + getUserName(fileSys))); 
       Path fsHome = fileSys.getHomeDirectory();
       assertEquals(home, fsHome);
 

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestModTime.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestModTime.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestModTime.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestModTime.java Tue Nov 23 01:49:59
2010
@@ -124,7 +124,7 @@ public class TestModTime extends TestCas
      //
      // create another directory
      //
-     Path dir2 = (new Path("testdir2/")).makeQualified(fileSys);
+     Path dir2 = fileSys.makeQualified(new Path("testdir2/"));
      System.out.println("Creating testdir2 " + dir2);
      assertTrue(fileSys.mkdirs(dir2));
      stat = fileSys.getFileStatus(dir2);

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockTokenWithDFS.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockTokenWithDFS.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockTokenWithDFS.java
(original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestBlockTokenWithDFS.java
Tue Nov 23 01:49:59 2010
@@ -200,7 +200,7 @@ public class TestBlockTokenWithDFS exten
       stm = fs.append(fileToAppend);
       int mid = rawData.length - 1;
       stm.write(rawData, 1, mid - 1);
-      stm.sync();
+      stm.hflush();
 
       /*
        * wait till token used in stm expires
@@ -252,7 +252,7 @@ public class TestBlockTokenWithDFS exten
       // write a partial block
       int mid = rawData.length - 1;
       stm.write(rawData, 0, mid);
-      stm.sync();
+      stm.hflush();
 
       /*
        * wait till token used in stm expires
@@ -314,7 +314,7 @@ public class TestBlockTokenWithDFS exten
        * testing READ interface on DN using a BlockReader
        */
 
-      DFSClient dfsclient = new DFSClient(new InetSocketAddress("localhost",
+      new DFSClient(new InetSocketAddress("localhost",
           cluster.getNameNodePort()), conf);
       List<LocatedBlock> locatedBlocks = cluster.getNameNode().getBlockLocations(
           FILE_TO_READ, 0, FILE_SIZE).getLocatedBlocks();

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestStreamFile.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestStreamFile.java?rev=1037961&r1=1037960&r2=1037961&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestStreamFile.java
(original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestStreamFile.java
Tue Nov 23 01:49:59 2010
@@ -75,6 +75,7 @@ class MockHttpServletResponse implements
     status = sc;
   }
   
+  @Deprecated
   public void setStatus(int sc, java.lang.String sm) {
   }
   
@@ -105,10 +106,12 @@ class MockHttpServletResponse implements
   public void sendError(int a, java.lang.String b) {
   }
   
+  @Deprecated
   public String encodeRedirectUrl(java.lang.String a) {
     return null;
   }
   
+  @Deprecated
   public String encodeUrl(java.lang.String url) {
     return null;
   }
@@ -117,6 +120,7 @@ class MockHttpServletResponse implements
     return null;
   }
   
+  @Deprecated
   public String encodeURL(java.lang.String url) {
     return null;
   }



Mime
View raw message