标签:hadoop
在Hadoop版本0.20.1, 0.21.0 存在一个bug,NameNode同步失败,current产生了一个edits.new,和fsimage同步时又出现异常,而SecondNameNode也产生了同样的目录结构和数据,并报如下异常:
Our secondary name node is not able to start on NullPointerException:
ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: java.lang.NullPointerException
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.unprotectedSetTimes(FSDirectory.java:1232)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.unprotectedSetTimes(FSDirectory.java:1221)
at org.apache.hadoop.hdfs.server.namenode.FSEditLog.loadFSEdits(FSEditLog.java:776)
at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSEdits(FSImage.java:992)
at
org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$CheckpointStorage.doMerge(SecondaryNameNode.java:590)
at
org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$CheckpointStorage.access$000(SecondaryNameNode.java:473)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doMerge(SecondaryNameNode.java:350)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:314)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:225)
at java.lang.Thread.run(Thread.java:619)
This was caused by setting access time on a non-existent file.
修改Hadoop源码:
Index: src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java =================================================================== --- src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java (revision 823221) +++ src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java (working copy) @@ -33,6 +33,7 @@ import org.apache.hadoop.hdfs.protocol.QuotaExceededException; import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption; import org.apache.hadoop.hdfs.server.namenode.BlocksMap.BlockInfo; +import org.mortbay.log.Log; /************************************************* * FSDirectory stores the filesystem directory state. @@ -1218,6 +1219,11 @@ boolean unprotectedSetTimes(String src, long mtime, long atime, boolean force) throws IOException { INodeFile inode = getFileINode(src); + if (inode == null) { + NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedSetTimes: " + +"failed to setTimes " + src + " because source does not exist"); + return false; + } return unprotectedSetTimes(src, inode, mtime, atime, force); }
启动NameNode报NullPointerException
标签:hadoop
原文地址:http://blog.csdn.net/u012841509/article/details/45354389