Review Board 1.7.22


DFSClient.getBlockLocations returns BlockLocations with no indication that the corresponding blocks are corrupt

Review Request #27 - Created Nov. 2, 2010 and submitted

Patrick Kling
HDFS-1483
Reviewers
hadoop-hdfs
hadoop-hdfs
DFSClient.getBlockLocations returns BlockLocations with no indication that the corresponding blocks are corrupt

When there are no uncorrupted replicas of a block, FSNamesystem.getBlockLocations returns LocatedBlocks corresponding to corrupt blocks. When DFSClient converts these to BlockLocations, the information that the corresponding block is corrupt is lost. We should add a field to BlockLocation to indicate whether the corresponding block is corrupt in order to warn the client that reading this block will fail. This would be especially useful for tools such as RAID FSCK, which could then easily inspect whether data or parity blocks are corrupted without having to make direct RPC calls
TestDFSUtil
http://svn.apache.org/repos/asf/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSUtil.java
Revision 1028386 New Change
[20] 217 lines
[+20] [+] public static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks) {
218
                                     locations[hCnt].getNetworkLocation());
218
                                     locations[hCnt].getNetworkLocation());
219
        racks[hCnt] = node.toString();
219
        racks[hCnt] = node.toString();
220
      }
220
      }
221
      blkLocations[idx] = new BlockLocation(names, hosts, racks,
221
      blkLocations[idx] = new BlockLocation(names, hosts, racks,
222
                                            blk.getStartOffset(),
222
                                            blk.getStartOffset(),
223
                                            blk.getBlockSize());
223
                                            blk.getBlockSize(),

    
   
224
                                            blk.isCorrupt());
224
      idx++;
225
      idx++;
225
    }
226
    }
226
    return blkLocations;
227
    return blkLocations;
227
  }
228
  }
228

    
   
229

   
229

    
   
230

   
230
}
231
}
231

    
   
232

   
http://svn.apache.org/repos/asf/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUtil.java
New File
 
  1. http://svn.apache.org/repos/asf/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DFSUtil.java: Loading...
  2. http://svn.apache.org/repos/asf/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSUtil.java: Loading...