Author: cutting
Date: Thu Jul 31 11:18:08 2008
New Revision: 681429
URL: http://svn.apache.org/viewvc?rev=681429&view=rev
Log:
HADOOP-3694. Improve unit test performance by changing MiniDFSCluster to only
listen on 127.0.0.1.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java
hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestFileCreation.java
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=681429&r1=681428&r2=681429&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Jul 31 11:18:08 2008
@@ -127,6 +127,9 @@
HADOOP-3791. Introduce generics into ReflectionUtils. (Chris Smith via
cdouglas)
+ HADOOP-3694. Improve unit test performance by changing
+ MiniDFSCluster to listen only on 127.0.0.1. (cutting)
+
OPTIMIZATIONS
HADOOP-3556. Removed lock contention in MD5Hash by changing the
Modified: hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java?rev=681429&r1=681428&r2=681429&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java
(original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java Thu
Jul 31 11:18:08 2008
@@ -243,7 +243,7 @@
// Setup the NameNode configuration
FileSystem.setDefaultUri(conf, "hdfs://localhost:"+
Integer.toString(nameNodePort));
- conf.set("dfs.http.address", "0.0.0.0:0");
+ conf.set("dfs.http.address", "127.0.0.1:0");
if (manageDfsDirs) {
conf.set("dfs.name.dir", new File(base_dir, "name1").getPath()+","+
new File(base_dir, "name2").getPath());
@@ -363,7 +363,7 @@
// Set up the right ports for the datanodes
conf.set("dfs.datanode.address", "127.0.0.1:0");
conf.set("dfs.datanode.http.address", "127.0.0.1:0");
- conf.set("dfs.datanode.ipc.address", "0.0.0.0:0");
+ conf.set("dfs.datanode.ipc.address", "127.0.0.1:0");
String[] args = (operation == null ||
operation == StartupOption.FORMAT ||
Modified:
hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestFileCreation.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestFileCreation.java?rev=681429&r1=681428&r2=681429&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestFileCreation.java
(original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestFileCreation.java Thu
Jul 31 11:18:08 2008
@@ -743,6 +743,8 @@
slowwriters[i].start();
}
+ Thread.sleep(1000); // let writers get started
+
//stop a datanode, it should have least recover.
cluster.stopDataNode(new Random().nextInt(REPLICATION));
@@ -753,6 +755,7 @@
finally {
for(int i = 0; i < slowwriters.length; i++) {
if (slowwriters[i] != null) {
+ slowwriters[i].running = false;
slowwriters[i].interrupt();
}
}
@@ -787,6 +790,7 @@
static class SlowWriter extends Thread {
final FileSystem fs;
final Path filepath;
+ boolean running = true;
SlowWriter(FileSystem fs, Path filepath) {
super(SlowWriter.class.getSimpleName() + ":" + filepath);
@@ -799,7 +803,7 @@
int i = 0;
try {
out = fs.create(filepath);
- for(; ; i++) {
+ for(; running; i++) {
System.out.println(getName() + " writes " + i);
out.write(i);
out.sync();