hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r936446 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java
Date Wed, 21 Apr 2010 19:06:56 GMT
Author: dhruba
Date: Wed Apr 21 19:06:56 2010
New Revision: 936446

URL: http://svn.apache.org/viewvc?rev=936446&view=rev
Log:
HDFS-966. NameNode does not recovers lease when it is in safemode.
(dhruba)


Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=936446&r1=936445&r2=936446&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Wed Apr 21 19:06:56 2010
@@ -270,6 +270,9 @@ Trunk (unreleased changes)
     HDFS-1088. Prevent renaming a symbolik link to its target.
     (Eli Collins via suresh)
 
+    HDFS-966. NameNode does not recovers lease when it is in safemode.
+    (dhruba)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java?rev=936446&r1=936445&r2=936446&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java Wed
Apr 21 19:06:56 2010
@@ -364,7 +364,9 @@ public class LeaseManager {
     public void run() {
       for(; fsnamesystem.isRunning(); ) {
         synchronized(fsnamesystem) {
-          checkLeases();
+          if (!fsnamesystem.isInSafeMode()) {
+            checkLeases();
+          }
         }
 
         try {

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java?rev=936446&r1=936445&r2=936446&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java Wed Apr
21 19:06:56 2010
@@ -23,9 +23,11 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
+import org.apache.hadoop.hdfs.protocol.FSConstants;
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.hdfs.server.datanode.TestInterDatanodeProtocol;
+import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
 
 public class TestLeaseRecovery extends junit.framework.TestCase {
   static final int BLOCK_SIZE = 1024;
@@ -119,6 +121,20 @@ public class TestLeaseRecovery extends j
         assertEquals(oldSize, updatedmetainfo[i].getNumBytes());
         assertEquals(currentGS, updatedmetainfo[i].getGenerationStamp());
       }
+
+      // verify that lease recovery does not occur when namenode is in safemode
+      System.out.println("Testing that lease recovery cannot happen during safemode.");
+      filestr = "/foo.safemode";
+      filepath = new Path(filestr);
+      dfs.create(filepath, (short)1);
+      cluster.getNameNode().setSafeMode(FSConstants.SafeModeAction.SAFEMODE_ENTER);
+      assertTrue(dfs.dfs.exists(filestr));
+      DFSTestUtil.waitReplication(dfs, filepath, (short)1);
+      waitLeaseRecovery(cluster);
+      // verify that we still cannot recover the lease
+      LeaseManager lm = cluster.getNamesystem().leaseManager;
+      assertTrue("Found " + lm.countLease() + " lease, expected 1", lm.countLease() == 1);
+      cluster.getNameNode().setSafeMode(FSConstants.SafeModeAction.SAFEMODE_LEAVE);
     }
     finally {
       if (cluster != null) {cluster.shutdown();}



Mime
View raw message