Class PBImageCorruptionDetector
java.lang.Object
org.apache.hadoop.hdfs.tools.offlineImageViewer.PBImageCorruptionDetector
- All Implemented Interfaces:
Closeable,AutoCloseable
The PBImageCorruptionDetector detects corruptions in the image.
It produces a file with the found issues similar to the Delimited
processor. The default delimiter is tab, as this is an unlikely value
to be included in an inode path. The delimiter value can be changed
via the constructor.
It looks for the following kinds of corruptions:
- an INode id is mentioned in the INodeDirectorySection, but not present
in the INodeSection (corrupt INode case)
- an INode has children, but at least one of them is corrupted
(missing children case)
If multiple layers of directory structure are damaged then it is possible
that an INode is corrupted and also having corrupted children.
Note that the OIV DetectCorruption processor check is not exhaustive,
and only catches the corruptions like above. This processor may be up to
extension in the future when new aspects of corruption are found.
-
Method Summary
Modifier and TypeMethodDescriptionvoidMethod called at the end of output() phase after all the inodes with known parentPath has been printed out.protected voidbuildNamespace(InputStream in, List<Long> refIdList) Scan the INodeDirectory section to construct the namespace.protected voidcheckNode(FsImageProto.INodeSection.INode p, AtomicInteger numDirs) Checks the inode (saves if directory), and counts them.voidclose()getEntry(String parentPath, FsImageProto.INodeSection.INode inode) Get text output for the given inode.getErasureCodingPolicyName(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto) Get text output for the header line.protected org.apache.hadoop.fs.permission.PermissionStatusgetPermission(long perm) intgetStoragePolicy(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto) static voidmergeFiles(String[] srcPaths, String resultPath) protected PrintStreamvoid
-
Method Details
-
getHeader
Get text output for the header line. -
getEntry
Get text output for the given inode.- Parameters:
parentPath- the path of parent directoryinode- the INode object to output.
-
checkNode
protected void checkNode(FsImageProto.INodeSection.INode p, AtomicInteger numDirs) throws IOException Checks the inode (saves if directory), and counts them. Can be overridden if additional steps are taken when iterating through INodeSection.- Throws:
IOException
-
buildNamespace
Scan the INodeDirectory section to construct the namespace.- Throws:
IOException
-
afterOutput
Method called at the end of output() phase after all the inodes with known parentPath has been printed out. Can be used to print additional data depending on the written inodes.- Throws:
IOException
-
serialOutStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
visit
- Throws:
IOException
-
getPermission
protected org.apache.hadoop.fs.permission.PermissionStatus getPermission(long perm) -
getStoragePolicy
-
mergeFiles
- Parameters:
srcPaths- Source files of contents to be mergedresultPath- Merged file path- Throws:
IOException
-
getErasureCodingPolicyName
public String getErasureCodingPolicyName(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)
-