HDFS-2152. TestWriteConfigurationToDFS causing the random failures. (Uma Maheswara Rao G via atm)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1147762 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c163455df4
commit
eaa0638c12
|
@ -840,6 +840,9 @@ Trunk (unreleased changes)
|
||||||
HDFS-2120. on reconnect, DN can connect to NN even with different source
|
HDFS-2120. on reconnect, DN can connect to NN even with different source
|
||||||
versions. (John George via atm)
|
versions. (John George via atm)
|
||||||
|
|
||||||
|
HDFS-2152. TestWriteConfigurationToDFS causing the random failures. (Uma
|
||||||
|
Maheswara Rao G via atm)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.hadoop.hdfs;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -35,15 +37,25 @@ public class TestWriteConfigurationToDFS {
|
||||||
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 4096);
|
conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 4096);
|
||||||
System.out.println("Setting conf in: " + System.identityHashCode(conf));
|
System.out.println("Setting conf in: " + System.identityHashCode(conf));
|
||||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||||
FileSystem fs = cluster.getFileSystem();
|
FileSystem fs = null;
|
||||||
Path filePath = new Path("/testWriteConf.xml");
|
OutputStream os = null;
|
||||||
OutputStream os = fs.create(filePath);
|
try {
|
||||||
StringBuilder longString = new StringBuilder();
|
fs = cluster.getFileSystem();
|
||||||
for (int i = 0; i < 100000; i++) {
|
Path filePath = new Path("/testWriteConf.xml");
|
||||||
longString.append("hello");
|
os = fs.create(filePath);
|
||||||
} // 500KB
|
StringBuilder longString = new StringBuilder();
|
||||||
conf.set("foobar", longString.toString());
|
for (int i = 0; i < 100000; i++) {
|
||||||
conf.writeXml(os);
|
longString.append("hello");
|
||||||
os.close();
|
} // 500KB
|
||||||
|
conf.set("foobar", longString.toString());
|
||||||
|
conf.writeXml(os);
|
||||||
|
os.close();
|
||||||
|
os = null;
|
||||||
|
fs.close();
|
||||||
|
fs = null;
|
||||||
|
} finally {
|
||||||
|
IOUtils.cleanup(null, os, fs);
|
||||||
|
cluster.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue