hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077648 - in /hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode: FSNamesystem.java LeaseManager.java
Date Fri, 04 Mar 2011 04:40:09 GMT
Author: omalley
Date: Fri Mar  4 04:40:08 2011
New Revision: 1077648

URL: http://svn.apache.org/viewvc?rev=1077648&view=rev
Log:
commit b6f3b4b2fceabed7243a282592941692a5731b65
Author: Konstantin Shvachko <shv@cdev6023.inktomisearch.com>
Date:   Fri Aug 6 21:34:56 2010 +0000

    HDFS-495 from https://issues.apache.org/jira/secure/attachment/12451466/HDFS-495.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HDFS-495. New clients should be able to take over files lease if the old
    +    client died. (shv)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1077648&r1=1077647&r2=1077648&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Fri Mar  4 04:40:08 2011
@@ -1141,28 +1141,28 @@ public class FSNamesystem implements FSC
         // If the file is under construction , then it must be in our
         // leases. Find the appropriate lease record.
         //
-        Lease lease = leaseManager.getLease(holder);
-        //
-        // We found the lease for this file. And surprisingly the original
-        // holder is trying to recreate this file. This should never occur.
-        //
-        if (lease != null) {
+        Lease lease = leaseManager.getLeaseByPath(src);
+        if (lease == null) {
           throw new AlreadyBeingCreatedException(
-                                                 "failed to create file " + src + " for "
+ holder +
-                                                 " on client " + clientMachine + 
-                                                 " because current leaseholder is trying
to recreate file.");
+              "failed to create file " + src + " for " + holder +
+              " on client " + clientMachine + 
+              " because pendingCreates is non-null but no leases found.");
         }
         //
-        // Find the original holder.
+        // We found the lease for this file. And surprisingly the original
+        // holder is trying to recreate this file. This should never occur.
         //
-        lease = leaseManager.getLease(pendingFile.clientName);
-        if (lease == null) {
+        if (lease.getHolder().equals(holder)) {
           throw new AlreadyBeingCreatedException(
-                                                 "failed to create file " + src + " for "
+ holder +
-                                                 " on client " + clientMachine + 
-                                                 " because pendingCreates is non-null but
no leases found.");
-        }
+              "failed to create file " + src + " for " + holder +
+              " on client " + clientMachine + 
+              " because current leaseholder is trying to recreate file.");
+        }
+        assert lease.getHolder().equals(pendingFile.getClientName()) :
+            "Current lease holder " + lease.getHolder() +
+            " does not match file creator " + pendingFile.getClientName();
         //
+        // Current lease holder is different from the requester.
         // If the original holder has not renewed in the last SOFTLIMIT 
         // period, then start lease recovery.
         //

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java?rev=1077648&r1=1077647&r2=1077648&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
Fri Mar  4 04:40:08 2011
@@ -265,7 +265,11 @@ public class LeaseManager {
     Collection<String> getPaths() {
       return paths;
     }
-    
+
+    String getHolder() {
+    	return holder;
+    }
+
     void replacePath(String oldpath, String newpath) {
       paths.remove(oldpath);
       paths.add(newpath);



Mime
View raw message