You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by to...@apache.org on 2011/05/14 05:27:04 UTC
svn commit: r1102945 - in /hadoop/hdfs/trunk: CHANGES.txt
src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java
Author: todd
Date: Sat May 14 03:27:04 2011
New Revision: 1102945
URL: http://svn.apache.org/viewvc?rev=1102945&view=rev
Log:
HDFS-1929. TestEditLogFileOutputStream fails if running on same host as NN. Contributed by Aaron T. Myers.
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1102945&r1=1102944&r2=1102945&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat May 14 03:27:04 2011
@@ -558,6 +558,9 @@ Trunk (unreleased changes)
HDFS-1938. Fix ivy-retrieve-hdfs dependence in build.xml and aop.xml.
(Eric Yang via szetszwo)
+ HDFS-1929. TestEditLogFileOutputStream fails if running on same host as NN
+ (Aaron T. Myers via todd)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java?rev=1102945&r1=1102944&r2=1102945&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java Sat May 14 03:27:04 2011
@@ -26,29 +26,30 @@ import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.DU;
-import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.hdfs.DFSTestUtil;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.junit.Test;
public class TestEditLogFileOutputStream {
@Test
public void testPreallocation() throws IOException {
- Configuration conf = new Configuration();
- FileSystem.setDefaultUri(conf, "hdfs://localhost:0");
- conf.set("dfs.http.address", "127.0.0.1:0");
- DFSTestUtil.formatNameNode(conf);
- NameNode nn = new NameNode(conf);
+ Configuration conf = new HdfsConfiguration();
+ MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0)
+ .build();
- File editLog = nn.getFSImage().getEditLog().getFsEditName();
+ File editLog = cluster.getNameNode().getFSImage().getEditLog()
+ .getFsEditName();
assertEquals("Edit log should only be 4 bytes long",
4, editLog.length());
assertEquals("Edit log disk space used should be one block",
4096, new DU(editLog, conf).getUsed());
- nn.mkdirs("/tmp", new FsPermission((short)777), false);
+ cluster.getFileSystem().mkdirs(new Path("/tmp"),
+ new FsPermission((short)777));
assertEquals("Edit log should be 1MB + 4 bytes long",
(1024 * 1024) + 4, editLog.length());