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-3206. Miscellaneous xml cleanups for OEV.
(Colin Patrick McCabe via eli)
OPTIMIZATIONS
HDFS-3024. Improve performance of stringification in addStoredBlock (todd)

View File

@ -1160,7 +1160,9 @@ public abstract class FSEditLogOp {
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "USERNAME", username);
if (username != null) {
XMLUtils.addSaxString(contentHandler, "USERNAME", username);
}
if (groupname != null) {
XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupname);
}
@ -1168,12 +1170,10 @@ public abstract class FSEditLogOp {
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
this.username = st.getValue("USERNAME");
if (st.hasChildren("GROUPNAME")) {
this.groupname = st.getValue("GROUPNAME");
} else {
this.groupname = null;
}
this.username = (st.hasChildren("USERNAME")) ?
st.getValue("USERNAME") : null;
this.groupname = (st.hasChildren("GROUPNAME")) ?
st.getValue("GROUPNAME") : null;
}
}
@ -2346,7 +2346,7 @@ public abstract class FSEditLogOp {
Long.valueOf(block.getBlockId()).toString());
XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
Long.valueOf(block.getNumBytes()).toString());
XMLUtils.addSaxString(contentHandler, "GENERATION_STAMP",
XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.valueOf(block.getGenerationStamp()).toString());
contentHandler.endElement("", "", "BLOCK");
}
@ -2355,7 +2355,7 @@ public abstract class FSEditLogOp {
throws InvalidXmlException {
long blockId = Long.valueOf(st.getValue("BLOCK_ID"));
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);
}

View File

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