diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 595d64915c1..54fec9ab92b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -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)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java
index a96aa3fc6ee..56a610f101e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java
@@ -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);
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored
index 5099ce21b30..75fb82ff751 100644
Binary files a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored and b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored differ
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored.xml
index 551ba53aa95..dded62ef49a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/editsStored.xml
@@ -247,7 +247,7 @@
-7144805496741076283
0
- 1004
+ 1004
@@ -266,12 +266,12 @@
-7144805496741076283
512
- 1004
+ 1004
-4125931756867080767
0
- 1005
+ 1005
@@ -290,17 +290,17 @@
-7144805496741076283
512
- 1004
+ 1004
-4125931756867080767
512
- 1005
+ 1005
1562413691487277050
0
- 1006
+ 1006
@@ -319,17 +319,17 @@
-7144805496741076283
512
- 1004
+ 1004
-4125931756867080767
512
- 1005
+ 1005
1562413691487277050
512
- 1006
+ 1006
todd
@@ -379,7 +379,7 @@
6084289468290363112
0
- 1008
+ 1008
@@ -398,12 +398,12 @@
6084289468290363112
512
- 1008
+ 1008
-4219431127125026105
0
- 1009
+ 1009
@@ -422,17 +422,17 @@
6084289468290363112
512
- 1008
+ 1008
-4219431127125026105
512
- 1009
+ 1009
-1765119074945211374
0
- 1010
+ 1010
@@ -451,17 +451,17 @@
6084289468290363112
512
- 1008
+ 1008
-4219431127125026105
512
- 1009
+ 1009
-1765119074945211374
512
- 1010
+ 1010
todd
@@ -511,7 +511,7 @@
-7448471719302683860
0
- 1012
+ 1012
@@ -530,12 +530,12 @@
-7448471719302683860
512
- 1012
+ 1012
-8051065559769974521
0
- 1013
+ 1013
@@ -554,17 +554,17 @@
-7448471719302683860
512
- 1012
+ 1012
-8051065559769974521
512
- 1013
+ 1013
3808670437711973616
0
- 1014
+ 1014
@@ -583,17 +583,17 @@
-7448471719302683860
512
- 1012
+ 1012
-8051065559769974521
512
- 1013
+ 1013
3808670437711973616
512
- 1014
+ 1014
todd
@@ -722,7 +722,7 @@
-357061736603024522
0
- 1016
+ 1016
@@ -734,7 +734,7 @@
-357061736603024522
0
- 1016
+ 1016
@@ -769,7 +769,7 @@
-357061736603024522
11
- 1017
+ 1017
todd
@@ -779,9 +779,17 @@
- OP_END_LOG_SEGMENT
+ OP_SET_OWNER
59
+ /file_create
+ newGroup
+
+
+
+ OP_END_LOG_SEGMENT
+
+ 60