Explorar o código

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 %!s(int64=17) %!d(string=hai) anos
pai
achega
0602042111
Modificáronse 2 ficheiros con 5 adicións e 16 borrados
  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
     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
 
   IMPROVEMENTS

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

@@ -480,7 +480,6 @@ public class FSEditLog {
     FSDirectory fsDir = fsNamesys.dir;
     int numEdits = 0;
     int logVersion = 0;
-    INode old = null;
     String clientName = null;
     String clientMachine = null;
     String path = null;
@@ -608,7 +607,7 @@ public class FSEditLog {
                                    " clientMachine " + clientMachine);
           }
 
-          old = fsDir.unprotectedDelete(path, mtime);
+          fsDir.unprotectedDelete(path, mtime);
 
           // add to the file tree
           INodeFile node = (INodeFile)fsDir.unprotectedAddFile(
@@ -633,15 +632,6 @@ public class FSEditLog {
                                       null);
             fsDir.replaceNode(path, node, cons);
             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;
         } 
@@ -676,11 +666,7 @@ public class FSEditLog {
           }
           path = FSImage.readString(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;
         }
         case OP_MKDIR: {