Skip to content

Commit

Permalink
HDFS-10186. DirectoryScanner: Improve logs by adding full path of bot…
Browse files Browse the repository at this point in the history
…h actual and expected block directories. Contributed by Rakesh R
  • Loading branch information
Tsz-Wo Nicholas Sze committed Apr 7, 2016
1 parent 4bd7cbc commit 654cd1d
Showing 1 changed file with 7 additions and 5 deletions.
Expand Up @@ -902,8 +902,7 @@ private LinkedList<ScanInfo> compileReport(FsVolumeSpi vol,
break;
}
}
verifyFileLocation(blockFile.getParentFile(), bpFinalizedDir,
blockId);
verifyFileLocation(blockFile, bpFinalizedDir, blockId);
report.add(new ScanInfo(blockId, blockFile, metaFile, vol));
}
return report;
Expand All @@ -913,12 +912,15 @@ private LinkedList<ScanInfo> compileReport(FsVolumeSpi vol,
* Verify whether the actual directory location of block file has the
* expected directory path computed using its block ID.
*/
private void verifyFileLocation(File actualBlockDir,
private void verifyFileLocation(File actualBlockFile,
File bpFinalizedDir, long blockId) {
File blockDir = DatanodeUtil.idToBlockDir(bpFinalizedDir, blockId);
if (actualBlockDir.compareTo(blockDir) != 0) {
if (actualBlockFile.getParentFile().compareTo(blockDir) != 0) {
File expBlockFile = new File(blockDir, actualBlockFile.getName());
LOG.warn("Block: " + blockId
+ " has to be upgraded to block ID-based layout");
+ " has to be upgraded to block ID-based layout. "
+ "Actual block file path: " + actualBlockFile
+ ", expected block file path: " + expBlockFile);
}
}

Expand Down

0 comments on commit 654cd1d

Please sign in to comment.