ソースを参照

HADOOP-5554. DataNodeCluster and CreateEditsLog should create blocks with the same generation stamp value. (hairong via szetszwo)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@757604 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 16 年 前
コミット
ff035e4209

+ 3 - 0
CHANGES.txt

@@ -83,6 +83,9 @@ Release 0.19.2 - Unreleased
     HADOOP-5549. ReplicationMonitor should schedule both replication and
     deletion work in one iteration. (hairong)
 
+    HADOOP-5554. DataNodeCluster and CreateEditsLog should create blocks with
+    the same generation stamp value. (hairong via szetszwo)
+
 Release 0.19.1 - 2009-02-23 
 
     HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is 

+ 2 - 1
src/test/org/apache/hadoop/hdfs/DataNodeCluster.java

@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption;
 import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
+import org.apache.hadoop.hdfs.server.namenode.CreateEditsLog;
 import org.apache.hadoop.net.DNS;
 
 
@@ -195,7 +196,7 @@ public class DataNodeCluster {
         for (int i_dn = 0; i_dn < numDataNodes; ++i_dn) {
           for (int i = 0; i < blocks.length; ++i) {
             blocks[i] = new Block(blkid++, blockSize,
-                Block.GRANDFATHER_GENERATION_STAMP);
+                CreateEditsLog.BLOCK_GENERATION_STAMP);
           }
           for (int i = 1; i <= replication; ++i) { 
             // inject blocks for dn_i into dn_i and replica in dn_i's neighbors 

+ 3 - 1
src/test/org/apache/hadoop/hdfs/CreateEditsLog.java → src/test/org/apache/hadoop/hdfs/server/namenode/CreateEditsLog.java

@@ -58,6 +58,8 @@ public class CreateEditsLog {
   static final String BASE_PATH = "/createdViaInjectingInEditsLog";
   static final String EDITS_DIR = "/tmp/EditsLogOut";
   static String edits_dir = EDITS_DIR;
+  static final public long BLOCK_GENERATION_STAMP =
+    GenerationStamp.FIRST_VALID_STAMP;
   
   static void addFiles(FSEditLog editLog, int numFiles, short replication, 
                          int blocksPerFile, long startingBlockId,
@@ -71,7 +73,7 @@ public class CreateEditsLog {
     BlockInfo[] blocks = new BlockInfo[blocksPerFile];
     for (int iB = 0; iB < blocksPerFile; ++iB) {
       blocks[iB] = 
-       new BlockInfo(new Block(0, blockSize, GenerationStamp.FIRST_VALID_STAMP),
+       new BlockInfo(new Block(0, blockSize, BLOCK_GENERATION_STAMP),
                                replication);
     }