Explorar o código

HADOOP-3681. DFSClient can get into an infinite loop while closing
a file if there are some errors. (Lohit Vijayarenu via rangadi)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.17@674930 13f79535-47bb-0310-9956-ffa450edef68

Raghu Angadi %!s(int64=17) %!d(string=hai) anos
pai
achega
583869ae12
Modificáronse 2 ficheiros con 15 adicións e 2 borrados
  1. 6 0
      CHANGES.txt
  2. 9 2
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 6 - 0
CHANGES.txt

@@ -1,5 +1,11 @@
 Hadoop Change Log
 
+Release 0.17.2 - Unreleased
+
+  BUG FIXES
+
+    HADOOP-3681. DFSClient can get into an infinite loop while closing
+    a file if there are some errors. (Lohit Vijayarenu via rangadi)
 
 Release 0.17.1 - 2008-06-23
 

+ 9 - 2
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -1887,8 +1887,9 @@ class DFSClient implements FSConstants {
                         " size:" + len + 
                         " offsetInBlock:" + offsetInBlock +
                         " lastPacketInBlock:" + one.lastPacketInBlock);
-            } catch (IOException e) {
-              LOG.warn("DataStreamer Exception: " + e);
+            } catch (Throwable e) {
+              LOG.warn("DataStreamer Exception: " + 
+                        StringUtils.stringifyException(e));
               hasError = true;
             }
           }
@@ -2629,6 +2630,7 @@ class DFSClient implements FSConstants {
           }
 
         flushInternal();             // flush all data to Datanodes
+        isClosed();
         closed = true;
 
         closeThreads();
@@ -2651,6 +2653,8 @@ class DFSClient implements FSConstants {
 
         long localstart = System.currentTimeMillis();
         boolean fileComplete = false;
+        int fileCompleteRetry = 0;
+        final int checkFileCompleteRetry = 10;
         while (!fileComplete) {
           fileComplete = namenode.complete(src, clientName);
           if (!fileComplete) {
@@ -2661,6 +2665,9 @@ class DFSClient implements FSConstants {
               }
             } catch (InterruptedException ie) {
             }
+            // after retrying for checkFileCompleteRetry times check isClosed() 
+            if ((++fileCompleteRetry % checkFileCompleteRetry) == 0) 
+              isClosed();
           }
         }
       } finally {