Browse Source

HADOOP-5384. Fix a problem that DataNodeCluster creates blocks with generationStamp == 1. (szetszwo)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@750241 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 16 years ago
parent
commit
48fc003a07
2 changed files with 6 additions and 4 deletions
  1. 3 0
      CHANGES.txt
  2. 3 4
      src/test/org/apache/hadoop/hdfs/DataNodeCluster.java

+ 3 - 0
CHANGES.txt

@@ -35,6 +35,9 @@ Release 0.19.2 - Unreleased
     HADOOP-4638. Fixes job recovery to not crash the job tracker for problems
     with a single job file. (Amar Kamat via yhemanth)
 
+    HADOOP-5384. Fix a problem that DataNodeCluster creates blocks with
+    generationStamp == 1.  (szetszwo)
+
 Release 0.19.1 - 2009-02-23
 
   INCOMPATIBLE CHANGES

+ 3 - 4
src/test/org/apache/hadoop/hdfs/DataNodeCluster.java

@@ -24,12 +24,10 @@ import java.security.SecureRandom;
 import java.util.Random;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hdfs.protocol.Block;
-import org.apache.hadoop.hdfs.server.common.HdfsConstants;
 import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption;
 import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.net.DNS;
 
 
@@ -196,7 +194,8 @@ public class DataNodeCluster {
         long blkid = startingBlockId;
         for (int i_dn = 0; i_dn < numDataNodes; ++i_dn) {
           for (int i = 0; i < blocks.length; ++i) {
-            blocks[i] = new Block(blkid++, blockSize, 1);
+            blocks[i] = new Block(blkid++, blockSize,
+                Block.GRANDFATHER_GENERATION_STAMP);
           }
           for (int i = 1; i <= replication; ++i) { 
             // inject blocks for dn_i into dn_i and replica in dn_i's neighbors