Recently, the same stack trace as in
appears again in the field. The symptom of the problem is that loadINodeDirectorySection() can't find a child inode in inodeMap by the node id in the children list of the directory. The child inode could be missing or deleted. HDFS-9406
As for now we didn't have a clear trace to reproduce the problem. Therefore, I'm proposing this improvement to detect such corruption (data structure inconsistency) when saving the FsImage, so that we can have the FsImage and Edit Log to hopefully reproduce the problem stably.
In a previous patch
HDFS-13314, [~arpitagarwal] did a great job catching potential FsImage corruption in two cases. This patch includes a third case where a child inode does not exist in the global FSDirectory dir when saving (serializing) INodeDirectorySection.