Browse Source

HADOOP-2918. Improve error logging so that dfs writes failure with
"No lease on file" can be diagnosed. (dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@632510 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 17 năm trước cách đây
mục cha
commit
a99892e834
2 tập tin đã thay đổi với 18 bổ sung2 xóa
  1. 3 0
      CHANGES.txt
  2. 15 2
      src/java/org/apache/hadoop/dfs/FSNamesystem.java

+ 3 - 0
CHANGES.txt

@@ -188,6 +188,9 @@ Release 0.16.1 - Unreleased
     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

+ 15 - 2
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -1172,8 +1172,21 @@ class FSNamesystem implements FSConstants, FSNamesystemMBean {
   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)) {