You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dh...@apache.org on 2008/03/01 01:35:09 UTC

svn commit: r632512 - in /hadoop/core/branches/branch-0.16: CHANGES.txt src/java/org/apache/hadoop/dfs/FSNamesystem.java

Author: dhruba
Date: Fri Feb 29 16:35:08 2008
New Revision: 632512

URL: http://svn.apache.org/viewvc?rev=632512&view=rev
Log:
HADOOP-2918.  Improve error logging so that dfs writes failure with
"No lease on file" can be diagnosed. (dhruba)
svn merge -c 632510


Modified:
    hadoop/core/branches/branch-0.16/CHANGES.txt
    hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java

Modified: hadoop/core/branches/branch-0.16/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/CHANGES.txt?rev=632512&r1=632511&r2=632512&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.16/CHANGES.txt Fri Feb 29 16:35:08 2008
@@ -85,6 +85,9 @@
     HADOOP-2904.  Fix to RPC metrics to log the correct host name. 
     (girish vaitheeswaran via dhruba)
 
+    HADOOP-2918.  Improve error logging so that dfs writes failure with
+    "No lease on file" can be diagnosed. (dhruba)
+
 Release 0.16.0 - 2008-02-07
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=632512&r1=632511&r2=632512&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/branches/branch-0.16/src/java/org/apache/hadoop/dfs/FSNamesystem.java Fri Feb 29 16:35:08 2008
@@ -1155,8 +1155,21 @@
   private INodeFileUnderConstruction checkLease(String src, String holder
       ) throws IOException {
     INode file = dir.getFileINode(src);
-    if (file == null || !file.isUnderConstruction()) {
-      throw new LeaseExpiredException("No lease on " + src);
+    if (file == null) {
+      Lease lease = getLease(holder);
+      throw new LeaseExpiredException("No lease on " + src +
+                                      " File does not exist. " +
+                                      (lease != null ? lease.toString() :
+                                       "Holder " + holder + 
+                                       " does not have any open files."));
+    }
+    if (!file.isUnderConstruction()) {
+      Lease lease = getLease(holder);
+      throw new LeaseExpiredException("No lease on " + src + 
+                                      " File is not open for writing. " +
+                                      (lease != null ? lease.toString() :
+                                       "Holder " + holder + 
+                                       " does not have any open files."));
     }
     INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction)file;
     if (holder != null && !pendingFile.getClientName().equals(holder)) {