Browse Source

HDFS-10572. Fix TestOfflineEditsViewer#testGenerated. Contributed by Surendra Singh Lilhore.

Akira Ajisaka 8 years ago
parent
commit
2e835d986e

+ 9 - 0
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java

@@ -698,6 +698,7 @@ public class FSImageSerialization {
     final Long limit = info.getLimit();
     final Long limit = info.getLimit();
     final FsPermission mode = info.getMode();
     final FsPermission mode = info.getMode();
     final Long maxRelativeExpiry = info.getMaxRelativeExpiryMs();
     final Long maxRelativeExpiry = info.getMaxRelativeExpiryMs();
+    final Short defaultReplication = info.getDefaultReplication();
 
 
     if (ownerName != null) {
     if (ownerName != null) {
       XMLUtils.addSaxString(contentHandler, "OWNERNAME", ownerName);
       XMLUtils.addSaxString(contentHandler, "OWNERNAME", ownerName);
@@ -716,6 +717,10 @@ public class FSImageSerialization {
       XMLUtils.addSaxString(contentHandler, "MAXRELATIVEEXPIRY",
       XMLUtils.addSaxString(contentHandler, "MAXRELATIVEEXPIRY",
           Long.toString(maxRelativeExpiry));
           Long.toString(maxRelativeExpiry));
     }
     }
+    if (defaultReplication != null) {
+      XMLUtils.addSaxString(contentHandler, "DEFAULTREPLICATION",
+          Short.toString(defaultReplication));
+    }
   }
   }
 
 
   public static CachePoolInfo readCachePoolInfo(Stanza st)
   public static CachePoolInfo readCachePoolInfo(Stanza st)
@@ -738,6 +743,10 @@ public class FSImageSerialization {
       info.setMaxRelativeExpiryMs(
       info.setMaxRelativeExpiryMs(
           Long.parseLong(st.getValue("MAXRELATIVEEXPIRY")));
           Long.parseLong(st.getValue("MAXRELATIVEEXPIRY")));
     }
     }
+    if (st.hasChildren("DEFAULTREPLICATION")) {
+      info.setDefaultReplication(Short.parseShort(st
+          .getValue("DEFAULTREPLICATION")));
+    }
     return info;
     return info;
   }
   }