HDFS-9290. DFSClient#callAppend() is not backward compatible for slightly older NameNodes. Contributed by Tony Wu.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b9e0417b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b9e0417b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b9e0417b Branch: refs/heads/HDFS-8966 Commit: b9e0417bdf2b9655dc4256bdb43683eca1ab46be Parents: ab3c4cf Author: Kihwal Lee <kih...@apache.org> Authored: Fri Oct 23 16:37:45 2015 -0500 Committer: Kihwal Lee <kih...@apache.org> Committed: Fri Oct 23 16:37:45 2015 -0500 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/hdfs/DFSClient.java | 8 +++++++- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9e0417b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index b460f26..8416918 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -1296,8 +1296,14 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory, try { LastBlockWithStatus blkWithStatus = namenode.append(src, clientName, new EnumSetWritable<>(flag, CreateFlag.class)); + HdfsFileStatus status = blkWithStatus.getFileStatus(); + if (status == null) { + DFSClient.LOG.debug("NameNode is on an older version, request file " + + "info with additional RPC call for file: " + src); + status = getFileInfo(src); + } return DFSOutputStream.newStreamForAppend(this, src, flag, progress, - blkWithStatus.getLastBlock(), blkWithStatus.getFileStatus(), + blkWithStatus.getLastBlock(), status, dfsClientConf.createChecksum(null), favoredNodes); } catch(RemoteException re) { throw re.unwrapRemoteException(AccessControlException.class, http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9e0417b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 23a54eb..e9e07d4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2189,6 +2189,9 @@ Release 2.7.2 - UNRELEASED HDFS-9220. Reading small file (< 512 bytes) that is open for append fails due to incorrect checksum (Jing Zhao via kihwal) + HDFS-9290. DFSClient#callAppend() is not backward compatible for slightly + older NameNodes. (Tony Wu via kihwal) + Release 2.7.1 - 2015-07-06 INCOMPATIBLE CHANGES