[
https://issues.apache.org/jira/browse/HDFS-8306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15154876#comment-15154876
]
Colin Patrick McCabe commented on HDFS-8306:
--------------------------------------------
{code}
FileSummary summary = FSImageUtil.loadSummary(file);
+ if (summary.getLayoutVersion() < LAYOUT_VERSION) {
+ throw new IOException(String.format(
+ "FSImage has layout version %d which is newer than the latest "
+ + "layout version supported by this OIV tool (%d).",
+ LAYOUT_VERSION, summary.getLayoutVersion()));
+ }
{code}
I agree that it is smart to avoid processing fsimage files which are newer than
the oiv tool itself. However, it seems like we should do this in a separate
JIRA, since it doesn't really have anything to do with adding xattr output.
{code}
+ private void dumpSummarySection(FileSummary s) throws IOException {
+ out.print("<Summary>");
+ o("ondiskVersion", s.getOndiskVersion());
+ o("layoutVersion", s.getLayoutVersion());
+ if (s.hasCodec()) {
+ o("codec", s.getCodec());
+ }
+ out.print("</Summary>\n");
+ }
{code}
Again, this isn't really necessary to just have xattr output. I ended up
adding this information in HDFS-9835, so I don't think it needs to be in this
patch.
{code}
+ if (f.hasStoragePolicyID() &&
+ f.getStoragePolicyID() !=
+ HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
+ o("storage-policy-id", f.getStoragePolicyID());
+ }
{code}
I added storage policy output in HDFS-9835
{{TestOfflineImageViewer.java}}: I understand why you added the XML parser here
for xattrs. However, it seems easier to test this as part of HDFS-9835, since
that change adds an XML parser for reading an entire fsimage file. So I think
we can skip this part. After all, we don't really need two XML parsers for the
same data.
We should keep in mind that the XML file is designed to be human-readable. So
if the key and/or value of the xattr can be expressed as a simple
null-terminated UTF-8 string, we should try to do that. Only if this isn't
possible should we base64-encode it.
It might make sense to do this after HDFS-9835, since that way it's easier to
unit test.
> Outputs Xattr in OIV XML format
> -------------------------------
>
> Key: HDFS-8306
> URL: https://issues.apache.org/jira/browse/HDFS-8306
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: namenode
> Affects Versions: 2.7.0
> Reporter: Lei (Eddy) Xu
> Assignee: Lei (Eddy) Xu
> Priority: Minor
> Labels: BB2015-05-TBR
> Attachments: HDFS-8306.000.patch, HDFS-8306.001.patch,
> HDFS-8306.002.patch, HDFS-8306.003.patch, HDFS-8306.004.patch,
> HDFS-8306.005.patch, HDFS-8306.006.patch, HDFS-8306.007.patch,
> HDFS-8306.008.patch, HDFS-8306.009.patch, HDFS-8306.debug0.patch,
> HDFS-8306.debug1.patch
>
>
> Currently, in the {{hdfs oiv}} XML outputs, not all fields of fsimage are
> outputs. It makes inspecting {{fsimage}} from XML outputs less practical.
> Also it prevents recovering a fsimage from XML file.
> This JIRA is adding ACL and XAttrs in the XML outputs as the first step to
> achieve the goal described in HDFS-8061.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)