HDFS-3206. Miscellaneous xml cleanups for OEV. Contributed by Colin Patrick McCabe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1327768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-04-19 01:31:53 +00:00
parent 0c16ec4d6e
commit 54e61ffdc0
4 changed files with 51 additions and 40 deletions

View File

@ -390,6 +390,9 @@ Release 2.0.0 - UNRELEASED
HDFS-3263. HttpFS should read HDFS config from Hadoop site.xml files (tucu) HDFS-3263. HttpFS should read HDFS config from Hadoop site.xml files (tucu)
HDFS-3206. Miscellaneous xml cleanups for OEV.
(Colin Patrick McCabe via eli)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-3024. Improve performance of stringification in addStoredBlock (todd) HDFS-3024. Improve performance of stringification in addStoredBlock (todd)

View File

@ -1160,7 +1160,9 @@ public String toString() {
@Override @Override
protected void toXml(ContentHandler contentHandler) throws SAXException { protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src); XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "USERNAME", username); if (username != null) {
XMLUtils.addSaxString(contentHandler, "USERNAME", username);
}
if (groupname != null) { if (groupname != null) {
XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupname); XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupname);
} }
@ -1168,12 +1170,10 @@ protected void toXml(ContentHandler contentHandler) throws SAXException {
@Override void fromXml(Stanza st) throws InvalidXmlException { @Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC"); this.src = st.getValue("SRC");
this.username = st.getValue("USERNAME"); this.username = (st.hasChildren("USERNAME")) ?
if (st.hasChildren("GROUPNAME")) { st.getValue("USERNAME") : null;
this.groupname = st.getValue("GROUPNAME"); this.groupname = (st.hasChildren("GROUPNAME")) ?
} else { st.getValue("GROUPNAME") : null;
this.groupname = null;
}
} }
} }
@ -2346,7 +2346,7 @@ public static void blockToXml(ContentHandler contentHandler, Block block)
Long.valueOf(block.getBlockId()).toString()); Long.valueOf(block.getBlockId()).toString());
XMLUtils.addSaxString(contentHandler, "NUM_BYTES", XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
Long.valueOf(block.getNumBytes()).toString()); Long.valueOf(block.getNumBytes()).toString());
XMLUtils.addSaxString(contentHandler, "GENERATION_STAMP", XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.valueOf(block.getGenerationStamp()).toString()); Long.valueOf(block.getGenerationStamp()).toString());
contentHandler.endElement("", "", "BLOCK"); contentHandler.endElement("", "", "BLOCK");
} }
@ -2355,7 +2355,7 @@ public static Block blockFromXml(Stanza st)
throws InvalidXmlException { throws InvalidXmlException {
long blockId = Long.valueOf(st.getValue("BLOCK_ID")); long blockId = Long.valueOf(st.getValue("BLOCK_ID"));
long numBytes = Long.valueOf(st.getValue("NUM_BYTES")); long numBytes = Long.valueOf(st.getValue("NUM_BYTES"));
long generationStamp = Long.valueOf(st.getValue("GENERATION_STAMP")); long generationStamp = Long.valueOf(st.getValue("GENSTAMP"));
return new Block(blockId, numBytes, generationStamp); return new Block(blockId, numBytes, generationStamp);
} }

View File

@ -247,7 +247,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7144805496741076283</BLOCK_ID> <BLOCK_ID>-7144805496741076283</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1004</GENERATION_STAMP> <GENSTAMP>1004</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -266,12 +266,12 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7144805496741076283</BLOCK_ID> <BLOCK_ID>-7144805496741076283</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1004</GENERATION_STAMP> <GENSTAMP>1004</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4125931756867080767</BLOCK_ID> <BLOCK_ID>-4125931756867080767</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1005</GENERATION_STAMP> <GENSTAMP>1005</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -290,17 +290,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7144805496741076283</BLOCK_ID> <BLOCK_ID>-7144805496741076283</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1004</GENERATION_STAMP> <GENSTAMP>1004</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4125931756867080767</BLOCK_ID> <BLOCK_ID>-4125931756867080767</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1005</GENERATION_STAMP> <GENSTAMP>1005</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>1562413691487277050</BLOCK_ID> <BLOCK_ID>1562413691487277050</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1006</GENERATION_STAMP> <GENSTAMP>1006</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -319,17 +319,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7144805496741076283</BLOCK_ID> <BLOCK_ID>-7144805496741076283</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1004</GENERATION_STAMP> <GENSTAMP>1004</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4125931756867080767</BLOCK_ID> <BLOCK_ID>-4125931756867080767</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1005</GENERATION_STAMP> <GENSTAMP>1005</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>1562413691487277050</BLOCK_ID> <BLOCK_ID>1562413691487277050</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1006</GENERATION_STAMP> <GENSTAMP>1006</GENSTAMP>
</BLOCK> </BLOCK>
<PERMISSION_STATUS> <PERMISSION_STATUS>
<USERNAME>todd</USERNAME> <USERNAME>todd</USERNAME>
@ -379,7 +379,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>6084289468290363112</BLOCK_ID> <BLOCK_ID>6084289468290363112</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1008</GENERATION_STAMP> <GENSTAMP>1008</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -398,12 +398,12 @@
<BLOCK> <BLOCK>
<BLOCK_ID>6084289468290363112</BLOCK_ID> <BLOCK_ID>6084289468290363112</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1008</GENERATION_STAMP> <GENSTAMP>1008</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4219431127125026105</BLOCK_ID> <BLOCK_ID>-4219431127125026105</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1009</GENERATION_STAMP> <GENSTAMP>1009</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -422,17 +422,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>6084289468290363112</BLOCK_ID> <BLOCK_ID>6084289468290363112</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1008</GENERATION_STAMP> <GENSTAMP>1008</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4219431127125026105</BLOCK_ID> <BLOCK_ID>-4219431127125026105</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1009</GENERATION_STAMP> <GENSTAMP>1009</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-1765119074945211374</BLOCK_ID> <BLOCK_ID>-1765119074945211374</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1010</GENERATION_STAMP> <GENSTAMP>1010</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -451,17 +451,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>6084289468290363112</BLOCK_ID> <BLOCK_ID>6084289468290363112</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1008</GENERATION_STAMP> <GENSTAMP>1008</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-4219431127125026105</BLOCK_ID> <BLOCK_ID>-4219431127125026105</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1009</GENERATION_STAMP> <GENSTAMP>1009</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-1765119074945211374</BLOCK_ID> <BLOCK_ID>-1765119074945211374</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1010</GENERATION_STAMP> <GENSTAMP>1010</GENSTAMP>
</BLOCK> </BLOCK>
<PERMISSION_STATUS> <PERMISSION_STATUS>
<USERNAME>todd</USERNAME> <USERNAME>todd</USERNAME>
@ -511,7 +511,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7448471719302683860</BLOCK_ID> <BLOCK_ID>-7448471719302683860</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1012</GENERATION_STAMP> <GENSTAMP>1012</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -530,12 +530,12 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7448471719302683860</BLOCK_ID> <BLOCK_ID>-7448471719302683860</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1012</GENERATION_STAMP> <GENSTAMP>1012</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-8051065559769974521</BLOCK_ID> <BLOCK_ID>-8051065559769974521</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1013</GENERATION_STAMP> <GENSTAMP>1013</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -554,17 +554,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7448471719302683860</BLOCK_ID> <BLOCK_ID>-7448471719302683860</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1012</GENERATION_STAMP> <GENSTAMP>1012</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-8051065559769974521</BLOCK_ID> <BLOCK_ID>-8051065559769974521</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1013</GENERATION_STAMP> <GENSTAMP>1013</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>3808670437711973616</BLOCK_ID> <BLOCK_ID>3808670437711973616</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1014</GENERATION_STAMP> <GENSTAMP>1014</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -583,17 +583,17 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-7448471719302683860</BLOCK_ID> <BLOCK_ID>-7448471719302683860</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1012</GENERATION_STAMP> <GENSTAMP>1012</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>-8051065559769974521</BLOCK_ID> <BLOCK_ID>-8051065559769974521</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1013</GENERATION_STAMP> <GENSTAMP>1013</GENSTAMP>
</BLOCK> </BLOCK>
<BLOCK> <BLOCK>
<BLOCK_ID>3808670437711973616</BLOCK_ID> <BLOCK_ID>3808670437711973616</BLOCK_ID>
<NUM_BYTES>512</NUM_BYTES> <NUM_BYTES>512</NUM_BYTES>
<GENERATION_STAMP>1014</GENERATION_STAMP> <GENSTAMP>1014</GENSTAMP>
</BLOCK> </BLOCK>
<PERMISSION_STATUS> <PERMISSION_STATUS>
<USERNAME>todd</USERNAME> <USERNAME>todd</USERNAME>
@ -722,7 +722,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-357061736603024522</BLOCK_ID> <BLOCK_ID>-357061736603024522</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1016</GENERATION_STAMP> <GENSTAMP>1016</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -734,7 +734,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-357061736603024522</BLOCK_ID> <BLOCK_ID>-357061736603024522</BLOCK_ID>
<NUM_BYTES>0</NUM_BYTES> <NUM_BYTES>0</NUM_BYTES>
<GENERATION_STAMP>1016</GENERATION_STAMP> <GENSTAMP>1016</GENSTAMP>
</BLOCK> </BLOCK>
</DATA> </DATA>
</RECORD> </RECORD>
@ -769,7 +769,7 @@
<BLOCK> <BLOCK>
<BLOCK_ID>-357061736603024522</BLOCK_ID> <BLOCK_ID>-357061736603024522</BLOCK_ID>
<NUM_BYTES>11</NUM_BYTES> <NUM_BYTES>11</NUM_BYTES>
<GENERATION_STAMP>1017</GENERATION_STAMP> <GENSTAMP>1017</GENSTAMP>
</BLOCK> </BLOCK>
<PERMISSION_STATUS> <PERMISSION_STATUS>
<USERNAME>todd</USERNAME> <USERNAME>todd</USERNAME>
@ -779,9 +779,17 @@
</DATA> </DATA>
</RECORD> </RECORD>
<RECORD> <RECORD>
<OPCODE>OP_END_LOG_SEGMENT</OPCODE> <OPCODE>OP_SET_OWNER</OPCODE>
<DATA> <DATA>
<TXID>59</TXID> <TXID>59</TXID>
<SRC>/file_create</SRC>
<GROUPNAME>newGroup</GROUPNAME>
</DATA>
</RECORD>
<RECORD>
<OPCODE>OP_END_LOG_SEGMENT</OPCODE>
<DATA>
<TXID>60</TXID>
</DATA> </DATA>
</RECORD> </RECORD>
</EDITS> </EDITS>