Browse Source

HADOOP-4054. Remove duplicate lease removal during edit log loading. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@694470 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang 17 years ago
parent
commit
0602042111
2 changed files with 5 additions and 16 deletions
  1. 3 0
      CHANGES.txt
  2. 2 16
      src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

+ 3 - 0
CHANGES.txt

@@ -516,6 +516,9 @@ Trunk (unreleased changes)
     HADOOP-4113. Changes to libhdfs to not exit on its own, rather return
     HADOOP-4113. Changes to libhdfs to not exit on its own, rather return
     an error code to the caller. (Pete Wyckoff via dhruba)
     an error code to the caller. (Pete Wyckoff via dhruba)
 
 
+    HADOOP-4054. Remove duplicate lease removal during edit log loading.
+    (hairong)
+
 Release 0.18.1 - Unreleased
 Release 0.18.1 - Unreleased
 
 
   IMPROVEMENTS
   IMPROVEMENTS

+ 2 - 16
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

@@ -480,7 +480,6 @@ public class FSEditLog {
     FSDirectory fsDir = fsNamesys.dir;
     FSDirectory fsDir = fsNamesys.dir;
     int numEdits = 0;
     int numEdits = 0;
     int logVersion = 0;
     int logVersion = 0;
-    INode old = null;
     String clientName = null;
     String clientName = null;
     String clientMachine = null;
     String clientMachine = null;
     String path = null;
     String path = null;
@@ -608,7 +607,7 @@ public class FSEditLog {
                                    " clientMachine " + clientMachine);
                                    " clientMachine " + clientMachine);
           }
           }
 
 
-          old = fsDir.unprotectedDelete(path, mtime);
+          fsDir.unprotectedDelete(path, mtime);
 
 
           // add to the file tree
           // add to the file tree
           INodeFile node = (INodeFile)fsDir.unprotectedAddFile(
           INodeFile node = (INodeFile)fsDir.unprotectedAddFile(
@@ -633,15 +632,6 @@ public class FSEditLog {
                                       null);
                                       null);
             fsDir.replaceNode(path, node, cons);
             fsDir.replaceNode(path, node, cons);
             fsNamesys.leaseManager.addLease(cons.clientName, path);
             fsNamesys.leaseManager.addLease(cons.clientName, path);
-          } else if (opcode == OP_CLOSE) {
-            //
-            // Remove lease if it exists.
-            //
-            if (old.isUnderConstruction()) {
-              INodeFileUnderConstruction cons = (INodeFileUnderConstruction)
-                                                   old;
-              fsNamesys.leaseManager.removeLease(cons.clientName, path);
-            }
           }
           }
           break;
           break;
         } 
         } 
@@ -676,11 +666,7 @@ public class FSEditLog {
           }
           }
           path = FSImage.readString(in);
           path = FSImage.readString(in);
           timestamp = readLong(in);
           timestamp = readLong(in);
-          old = fsDir.unprotectedDelete(path, timestamp);
-          if (old != null && old.isUnderConstruction()) {
-            INodeFileUnderConstruction cons = (INodeFileUnderConstruction)old;
-            fsNamesys.leaseManager.removeLease(cons.clientName, path);
-          }
+          fsDir.unprotectedDelete(path, timestamp);
           break;
           break;
         }
         }
         case OP_MKDIR: {
         case OP_MKDIR: {