Author: rangadi
Date: Tue Jun 16 01:31:06 2009
New Revision: 785046
URL: http://svn.apache.org/viewvc?rev=785046&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/trunk/CHANGES.txt
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
hadoop/core/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestRenameWhileOpen.java
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=785046&r1=785045&r2=785046&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Jun 16 01:31:06 2009
@@ -2988,6 +2988,10 @@
HADOOP-5644. Namenode 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
Modified:
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java?rev=785046&r1=785045&r2=785046&view=diff
==============================================================================
---
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
(original)
+++
hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
Tue Jun 16 01:31:06 2009
@@ -281,11 +281,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/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestRenameWhileOpen.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestRenameWhileOpen.java?rev=785046&r1=785045&r2=785046&view=diff
==============================================================================
---
hadoop/core/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestRenameWhileOpen.java
(original)
+++
hadoop/core/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestRenameWhileOpen.java
Tue Jun 16 01:31:06 2009
@@ -82,6 +82,17 @@
fs.mkdirs(dir3);
fs.rename(dir1, dir3);
+ // create file3
+ Path file3 = new Path(dir3, "file3");
+ FSDataOutputStream stm3 = TestFileCreation.createFile(fs, file3, 1);
+ TestFileCreation.writeFile(stm3);
+ // rename file3 to some bad name
+ try {
+ fs.rename(file3, new Path(dir3, "$ "));
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
// restart cluster with the same namenode port as before.
// This ensures that leases are persisted in fsimage.
cluster.shutdown();