소스 검색

Merge r:1343944 HDFS-3398. Client will not retry when primaryDN is down once it's just got pipeline. Contributed by Amith D K.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1343948 13f79535-47bb-0310-9956-ffa450edef68
Uma Maheswara Rao G 13 년 전
부모
커밋
48a439ea7e

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -121,6 +121,9 @@ Release 2.0.1-alpha - UNRELEASED
     HDFS-3452. BKJM:Switch from standby to active fails and NN gets shut down
     HDFS-3452. BKJM:Switch from standby to active fails and NN gets shut down
     due to delay in clearing of lock. (umamahesh)
     due to delay in clearing of lock. (umamahesh)
 
 
+    HDFS-3398. Client will not retry when primaryDN is down once it's just got pipeline.
+    (Amith D K via umamahesh)
+
 Release 2.0.0-alpha - UNRELEASED
 Release 2.0.0-alpha - UNRELEASED
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 9 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java

@@ -507,8 +507,15 @@ public class DFSOutputStream extends FSOutputSummer implements Syncable {
           }
           }
 
 
           // write out data to remote datanode
           // write out data to remote datanode
-          blockStream.write(buf.array(), buf.position(), buf.remaining());
-          blockStream.flush();
+          try {            
+            blockStream.write(buf.array(), buf.position(), buf.remaining());
+            blockStream.flush();   
+          } catch (IOException e) {
+            // HDFS-3398 treat primary DN is down since client is unable to 
+            // write to primary DN 
+            errorIndex = 0;
+            throw e;
+          }
           lastPacket = System.currentTimeMillis();
           lastPacket = System.currentTimeMillis();
           
           
           if (one.isHeartbeatPacket()) {  //heartbeat packet
           if (one.isHeartbeatPacket()) {  //heartbeat packet