Repository: hadoop Updated Branches: refs/heads/branch-2 303ee13e3 -> 30b43a2d4
HDFS-11476. Fix NPE in FsDatasetImpl#checkAndUpdate. Contributed by Xiaobing Zhou. (cherry picked from commit ac5ae0065a127ac150a887fa6c6f3cffd86ef733) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/30b43a2d Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/30b43a2d Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/30b43a2d Branch: refs/heads/branch-2 Commit: 30b43a2d4edf82be0c5471905beb38283e0bd4a5 Parents: 303ee13 Author: Jing Zhao <[email protected]> Authored: Fri Mar 3 13:31:20 2017 -0800 Committer: Jing Zhao <[email protected]> Committed: Fri Mar 3 13:35:13 2017 -0800 ---------------------------------------------------------------------- .../server/datanode/fsdataset/impl/FsDatasetImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/30b43a2d/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index 3738f87..ca11776 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -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 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
