hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r785057 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/LeaseManager.java src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java
Date Tue, 16 Jun 2009 02:21:22 GMT
Author: rangadi
Date: Tue Jun 16 02:21:22 2009
New Revision: 785057

URL: http://svn.apache.org/viewvc?rev=785057&view=rev
Log:
HADOOP-6017. Lease Manager in NameNode does not handle certain characters
in filenames. This results in fatal errors in Secondary NameNode and while
restrating NameNode. (Tsz Wo (Nicholas), SZE via rangadi)

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt   (contents, props changed)
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=785057&r1=785056&r2=785057&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Tue Jun 16 02:21:22 2009
@@ -25,6 +25,10 @@
 
     HADOOP-5644. Namnode is stuck in safe mode. (Suresh Srinivas via hairong)
 
+    HADOOP-6017. Lease Manager in NameNode does not handle certain characters
+    in filenames. This results in fatal errors in Secondary NameNode and while
+    restrating NameNode. (Tsz Wo (Nicholas), SZE via rangadi)
+
 Release 0.18.3 - 2009-01-27
 
   IMPROVEMENTS

Propchange: hadoop/core/branches/branch-0.18/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 16 02:21:22 2009
@@ -1 +1,2 @@
-/hadoop/core/trunk/CHANGES.txt:699517,700163,700923,704701,705420,705430,707258,709040,720602,723460,723831,723918,732572,741703,743892,753346,759398
+/hadoop/core/branches/branch-0.20/CHANGES.txt:785053
+/hadoop/core/trunk/CHANGES.txt:699517,700163,700923,704701,705420,705430,707258,709040,720602,723460,723831,723918,732572,741703,743892,753346,759398,785046

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java?rev=785057&r1=785056&r2=785057&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java Tue
Jun 16 02:21:22 2009
@@ -282,11 +282,12 @@
                ", replaceBy=" + replaceBy);
     }
 
+    final int len = overwrite.length();
     for(Map.Entry<String, Lease> entry : findLeaseWithPrefixPath(src, sortedLeasesByPath))
{
       final String oldpath = entry.getKey();
       final Lease lease = entry.getValue();
-      final String newpath = oldpath.replaceFirst(
-          java.util.regex.Pattern.quote(overwrite), replaceBy);
+      //overwrite must be a prefix of oldpath
+      final String newpath = replaceBy + oldpath.substring(len);
       if (LOG.isDebugEnabled()) {
         LOG.debug("changeLease: replacing " + oldpath + " with " + newpath);
       }

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java?rev=785057&r1=785056&r2=785057&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestRenameWhileOpen.java
Tue Jun 16 02:21:22 2009
@@ -92,9 +92,8 @@
    * move /user/dir1 /user/dir3
    */
   public void testWhileOpenRenameParent() throws IOException {
-    /* XXX This test is temporarily disabled since sync() is not supported in
-     * 0.18.3. This is a 0.18.3 only change. */
-    if (true) return;
+    /* XXX parts of This test are temporarily disabled since sync() is not
+     * supported in 0.18.3. This is a 0.18.3 only change. */
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
@@ -111,6 +110,8 @@
       fs = cluster.getFileSystem();
       final int nnport = cluster.getNameNodePort();
 
+      Path dir3 = new Path("/user/dir3");
+      if (false) {// Removed in 0.18
       // create file1.
       Path dir1 = new Path("/user/a+b/dir1");
       Path file1 = new Path(dir1, "file1");
@@ -130,10 +131,24 @@
       stm2.sync();
 
       // move dir1 while file1 is open
-      Path dir3 = new Path("/user/dir3");
       fs.mkdirs(dir3);
       fs.rename(dir1, dir3);
-
+      }
+      
+      // create file3
+      Path file3 = new Path(dir3, "file3");
+      FSDataOutputStream stm3 = TestFileCreation.createFile(fs, file3, 1);
+      writeFile(stm3);
+      // rename file3 to some bad name
+      try {
+        fs.rename(file3, new Path(dir3, "$ "));
+      } catch(Exception e) {
+        e.printStackTrace();
+      }
+      try { // ignore the io excpeiton while closing.
+        stm3.close();
+      } catch (IOException ignored) {}
+      
       // restart cluster with the same namenode port as before.
       // This ensures that leases are persisted in fsimage.
       cluster.shutdown();
@@ -151,11 +166,13 @@
       cluster.waitActive();
       fs = cluster.getFileSystem();
 
+      /* XXX Removed in 0.18
       Path newfile = new Path("/user/dir3/dir1", "file1");
       assertTrue(!fs.exists(file1));
       assertTrue(fs.exists(file2));
       assertTrue(fs.exists(newfile));
       checkFullFile(fs, newfile);
+      */
     } finally {
       fs.close();
       cluster.shutdown();



Mime
View raw message