HDFS-11476. Fix NPE in FsDatasetImpl#checkAndUpdate. Contributed by Xiaobing Zhou.

(cherry picked from commit ac5ae0065a)
This commit is contained in:
Jing Zhao 2017-03-03 13:31:20 -08:00
parent 303ee13e3c
commit 30b43a2d4e
1 changed files with 7 additions and 5 deletions

View File

@ -2450,11 +2450,13 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
File memMetaFile = FsDatasetUtil.getMetaFile(diskFile,
memBlockInfo.getGenerationStamp());
if (fileIoProvider.exists(vol, memMetaFile)) {
if (memMetaFile.compareTo(diskMetaFile) != 0) {
LOG.warn("Metadata file in memory "
+ memMetaFile.getAbsolutePath()
+ " does not match file found by scan "
+ (diskMetaFile == null? null: diskMetaFile.getAbsolutePath()));
String warningPrefix = "Metadata file in memory "
+ memMetaFile.getAbsolutePath()
+ " does not match file found by scan ";
if (!diskMetaFileExists) {
LOG.warn(warningPrefix + "null");
} else if (memMetaFile.compareTo(diskMetaFile) != 0) {
LOG.warn(warningPrefix + diskMetaFile.getAbsolutePath());
}
} else {
// Metadata file corresponding to block in memory is missing