hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hair...@apache.org
Subject svn commit: r898573 - in /hadoop/hdfs/trunk: ./ src/java/org/apache/hadoop/hdfs/server/datanode/ src/java/org/apache/hadoop/hdfs/server/protocol/ src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/
Date Tue, 12 Jan 2010 23:30:44 GMT
Author: hairong
Date: Tue Jan 12 23:30:43 2010
New Revision: 898573

URL: http://svn.apache.org/viewvc?rev=898573&view=rev
Log:
HDFS-699. Primary datanode should compare replicas' on disk lengths. Contributed by Hairong
Kuang.

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaUnderRecovery.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=898573&r1=898572&r2=898573&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Jan 12 23:30:43 2010
@@ -619,6 +619,9 @@
     
     HDFS-880. TestNNLeaseRecovery fails on windows (cos, shv)
 
+    HDFS-699. Primary datanode should compare replicas' on disk lengths.
+    (hairong)
+
 Release 0.20.2 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaUnderRecovery.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaUnderRecovery.java?rev=898573&r1=898572&r2=898573&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaUnderRecovery.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaUnderRecovery.java
Tue Jan 12 23:30:43 2010
@@ -168,6 +168,8 @@
   }
 
   ReplicaRecoveryInfo createInfo() {
-    return new ReplicaRecoveryInfo(this, getOrignalReplicaState()); 
+    return new ReplicaRecoveryInfo(original.getBlockId(), 
+        original.getBytesOnDisk(), original.getGenerationStamp(),
+        getOrignalReplicaState()); 
   }
 }

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java?rev=898573&r1=898572&r2=898573&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java
Tue Jan 12 23:30:43 2010
@@ -37,8 +37,8 @@
   public ReplicaRecoveryInfo() {
   }
 
-  public ReplicaRecoveryInfo(Block r, ReplicaState rState) {
-    super(r);
+  public ReplicaRecoveryInfo(long blockId, long diskLen, long gs, ReplicaState rState) {
+    set(blockId, diskLen, gs);
     originalState = rState;
   }
 

Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java?rev=898573&r1=898572&r2=898573&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
(original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
Tue Jan 12 23:30:43 2010
@@ -790,7 +790,15 @@
   @Override
   public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock)
   throws IOException {
-    return new ReplicaRecoveryInfo(rBlock.getBlock(), ReplicaState.FINALIZED);
+    Block b = rBlock.getBlock();
+    BInfo binfo = blockMap.get(b);
+    if (binfo == null) {
+      throw new IOException("No such Block " + b );  
+    }
+
+    return new ReplicaRecoveryInfo(binfo.getBlockId(), binfo.getBytesOnDisk(), 
+        binfo.getGenerationStamp(), 
+        binfo.isFinalized()?ReplicaState.FINALIZED : ReplicaState.RBW);
   }
 
   @Override // FSDatasetInterface



Mime
View raw message