@@ -6131,15 +6131,20 @@ void releaseBackupNode(NamenodeRegistration registration)
61316131 static class CorruptFileBlockInfo {
61326132 final String path ;
61336133 final Block block ;
6134+ private final int replication ;
6135+ private final String ecPolicy ;
61346136
6135- public CorruptFileBlockInfo (String p , Block b ) {
6137+ CorruptFileBlockInfo (String p , Block b , int r , String ec ) {
61366138 path = p ;
61376139 block = b ;
6140+ replication = r ;
6141+ ecPolicy = ec ;
61386142 }
61396143
61406144 @ Override
61416145 public String toString () {
6142- return block .getBlockName () + "\t " + path ;
6146+ return block .getBlockName () + "\t " +
6147+ (replication == -1 ? ecPolicy : replication ) + "\t " + path ;
61436148 }
61446149 }
61456150 /**
@@ -6195,7 +6200,21 @@ Collection<CorruptFileBlockInfo> listCorruptFileBlocks(String path,
61956200 if (inode != null ) {
61966201 String src = inode .getFullPathName ();
61976202 if (isParentEntry (src , path )) {
6198- corruptFiles .add (new CorruptFileBlockInfo (src , blk ));
6203+ int repl = -1 ;
6204+ String ecPolicyName = null ;
6205+ if (inode .isFile ()) {
6206+ if (inode .asFile ().isStriped ()) {
6207+ ErasureCodingPolicy ecPolicy =
6208+ ErasureCodingPolicyManager .getInstance ()
6209+ .getByID (inode .asFile ().getErasureCodingPolicyID ());
6210+ if (ecPolicy != null ) {
6211+ ecPolicyName = ecPolicy .getName ();
6212+ }
6213+ } else {
6214+ repl = inode .asFile ().getFileReplication ();
6215+ }
6216+ }
6217+ corruptFiles .add (new CorruptFileBlockInfo (src , blk , repl , ecPolicyName ));
61996218 count ++;
62006219 if (count >= maxCorruptFileBlocksReturn )
62016220 break ;
0 commit comments