HDFS-3948. Do not use hflush in TestWebHDFS.testNamenodeRestart() since the out stream returned by WebHdfsFileSystem does not support it. Contributed by Jing Zhao

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1402270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2012-10-25 18:53:25 +00:00
parent ba2ee1d7fb
commit 2d74f68054
2 changed files with 23 additions and 6 deletions

View File

@ -496,6 +496,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

View File

@ -876,7 +876,14 @@ public static void namenodeRestartTest(final Configuration conf,
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));
@ -889,10 +896,12 @@ public static void namenodeRestartTest(final Configuration conf,
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);
}
@ -975,7 +984,11 @@ public void run() {
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();
}