From 6f9154270775f13fc0990879fc3deda7b189237d Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Thu, 25 Oct 2012 18:58:35 +0000 Subject: [PATCH] svn merge -c 1402270 from trunk for HDFS-3948. Do not use hflush in TestWebHDFS.testNamenodeRestart() since the out stream returned by WebHdfsFileSystem does not support it. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1402273 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 4 +++ .../hadoop/hdfs/TestDFSClientRetries.java | 25 ++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 98c09819994..5932770b736 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -150,6 +150,10 @@ Release 2.0.3-alpha - Unreleased HDFS-4022. Replication not happening for appended block. (Vinay via umamahesh) + HDFS-3948. Do not use hflush in TestWebHDFS.testNamenodeRestart() since the + out stream returned by WebHdfsFileSystem does not support it. (Jing Zhao + via szetszwo) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java index 35b8a13d57a..36fb157590b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java @@ -824,7 +824,14 @@ public class TestDFSClientRetries { new Random().nextBytes(bytes); out4.write(bytes); out4.write(bytes); - out4.hflush(); + if (isWebHDFS) { + // WebHDFS does not support hflush. To avoid DataNode communicating with + // NN while we're shutting down NN, we call out4.close() to finish + // writing the data + out4.close(); + } else { + out4.hflush(); + } //shutdown namenode assertTrue(HdfsUtils.isHealthy(uri)); @@ -837,10 +844,12 @@ public class TestDFSClientRetries { public void run() { try { //write some more data and then close the file - out4.write(bytes); - out4.write(bytes); - out4.write(bytes); - out4.close(); + if (!isWebHDFS) { + out4.write(bytes); + out4.write(bytes); + out4.write(bytes); + out4.close(); + } } catch (Exception e) { exceptions.add(e); } @@ -923,7 +932,11 @@ public class TestDFSClientRetries { Assert.assertEquals(String.format("count=%d", count), bytes[count % bytes.length], (byte)r); } - Assert.assertEquals(5 * bytes.length, count); + if (!isWebHDFS) { + Assert.assertEquals(5 * bytes.length, count); + } else { + Assert.assertEquals(2 * bytes.length, count); + } in.close(); }