Class PBImageDelimitedTextWriter
java.lang.Object
org.apache.hadoop.hdfs.tools.offlineImageViewer.PBImageDelimitedTextWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
A PBImageDelimitedTextWriter generates a text representation of the PB fsimage,
with each element separated by a delimiter string. All of the elements
common to both inodes and inodes-under-construction are included. When
processing an fsimage with a layout version that did not include an
element, such as AccessTime, the output file will include a column
for the value, but no value will be included.
Individual block information for each file is not currently included.
The default delimiter is tab, as this is an unlikely value to be included in
an inode path or other text metadata. The delimiter value can be via the
constructor.
-
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 parent, 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
-
getEntry
Get text output for the given inode.- Parameters:
parent- the path of parent directoryinode- the INode object to output.
-
getHeader
Get text output for the header line. -
afterOutput
public void 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. -
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) -
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
-
getStoragePolicy
-
mergeFiles
- Parameters:
srcPaths- Source files of contents to be mergedresultPath- Merged file path- Throws:
IOException
-
getErasureCodingPolicyName
public String getErasureCodingPolicyName(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)
-