From 48a439ea7ea1bef685003c9078107feea6559d6b Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Tue, 29 May 2012 19:43:41 +0000 Subject: [PATCH] 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 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/hdfs/DFSOutputStream.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b1740177a61..750998f126d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/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 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 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java index 039b40c7c7e..e5e79dc7ced 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java +++ b/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 - 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(); if (one.isHeartbeatPacket()) { //heartbeat packet