Browse Source

HADOOP-3846. Fix unit test CreateEditsLog to generate paths correctly. Contributed by Lohit Vjayarenu

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@683448 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 17 years ago
parent
commit
7292526e1f
2 changed files with 12 additions and 6 deletions
  1. 3 0
      CHANGES.txt
  2. 9 6
      src/test/org/apache/hadoop/hdfs/CreateEditsLog.java

+ 3 - 0
CHANGES.txt

@@ -227,6 +227,9 @@ Trunk (unreleased changes)
     HADOOP-3805. Improve fuse-dfs write performance.
     (Pete Wyckoff via zshao)
 
+    HADOOP-3846. Fix unit test CreateEditsLog to generate paths correctly. 
+    (Lohit Vjayarenu via cdouglas)
+
 Release 0.18.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 9 - 6
src/test/org/apache/hadoop/hdfs/CreateEditsLog.java

@@ -36,15 +36,15 @@ import org.apache.hadoop.fs.permission.PermissionStatus;
  * 
  * CreateEditsLog
  *   Synopsis: CreateEditsLog -f numFiles StartingBlockId numBlocksPerFile
- *        [-d editsLogDirectory]
+ *        [-r replicafactor] [-d editsLogDirectory]
  *             Default replication factor is 1
  *             Default edits log directory is /tmp/EditsLogOut
  *   
- *   Create an name node's fsimage edits log in /tmp/EditsLogOut.
+ *   Create a name node's edits log in /tmp/EditsLogOut.
  *   The file /tmp/EditsLogOut/current/edits can be copied to a name node's
- *   fsimage directory and the name node can be started off it.
+ *   dfs.name.dir/current direcotry and the name node can be started as usual.
  *   
- *   The file are created in /createdViaInjectingInEditsLog
+ *   The files are created in /createdViaInjectingInEditsLog
  *   The file names contain the starting and ending blockIds; hence once can 
  *   create multiple edits logs using this command using non overlapping 
  *   block ids and feed the files to a single name node.
@@ -87,9 +87,12 @@ public class CreateEditsLog {
 
         INodeFileUnderConstruction inode = new INodeFileUnderConstruction(
                       null, replication, 0, blockSize, blocks, p, "", "", null);
-        String path = iF + "_B" + blocks[0].getBlockId() + 
+        // Append path to filename with information about blockIDs 
+        String path = "_" + iF + "_B" + blocks[0].getBlockId() + 
                       "_to_B" + blocks[blocksPerFile-1].getBlockId() + "_";
-        String filePath = nameGenerator.getNextFileName(path);
+        String filePath = nameGenerator.getNextFileName("");
+        filePath = filePath + path;
+        // Log the new sub directory in edits
         if ((iF % nameGenerator.getFilesPerDirectory())  == 0) {
           String currentDir = nameGenerator.getCurrentDir();
           dirInode = new INodeDirectory(p, 0L);