You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/08/04 21:37:35 UTC

svn commit: r428854 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/DFSck.java

Author: cutting
Date: Fri Aug  4 12:37:34 2006
New Revision: 428854

URL: http://svn.apache.org/viewvc?rev=428854&view=rev
Log:
HADOOP-226.  Fix fsck to properly handle replication counts, now that these can vary per file.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSck.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=428854&r1=428853&r2=428854&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Aug  4 12:37:34 2006
@@ -139,6 +139,9 @@
     Also, move JobConf.newInstance() to a new utility class.
     (Hairong Kuang via cutting)
 
+40. HADOOP-226.  Fix fsck command to properly consider replication
+    counts, now that these can vary per file.  (Bryan Pendleton via cutting)
+
 
 Release 0.4.0 - 2006-06-28
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSck.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSck.java?rev=428854&r1=428853&r2=428854&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSck.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSck.java Fri Aug  4 12:37:34 2006
@@ -151,8 +151,9 @@
       Block block = blocks[i].getBlock();
       long id = block.getBlockId();
       DatanodeInfo[] locs = blocks[i].getLocations();
-      if (locs.length > res.replication) res.overReplicatedBlocks += (locs.length - res.replication);
-      if (locs.length < res.replication && locs.length > 0) res.underReplicatedBlocks += (res.replication - locs.length);
+      short targetFileReplication = file.getReplication();
+      if (locs.length > targetFileReplication) res.overReplicatedBlocks += (locs.length - targetFileReplication);
+      if (locs.length < targetFileReplication && locs.length > 0) res.underReplicatedBlocks += (targetFileReplication - locs.length);
       report.append(i + ". " + id + " len=" + block.getNumBytes());
       if (locs == null || locs.length == 0) {
         report.append(" MISSING!");