From 5057390cad229fa007bbf3c72d61749d7f9d8cf9 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Sun, 3 Jul 2016 21:11:56 -0700 Subject: [PATCH] HDFS-10572. Fix TestOfflineEditsViewer#testGenerated. Contributed by Surendra Singh Lilhore. (cherry picked from commit 2e835d986ecdc881eab3ab9650d854b6df482b20) --- .../hdfs/server/namenode/FSImageSerialization.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java index 8df65f7b8a4..64756275674 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageSerialization.java @@ -696,6 +696,7 @@ public static void writeCachePoolInfo(ContentHandler contentHandler, final Long limit = info.getLimit(); final FsPermission mode = info.getMode(); final Long maxRelativeExpiry = info.getMaxRelativeExpiryMs(); + final Short defaultReplication = info.getDefaultReplication(); if (ownerName != null) { XMLUtils.addSaxString(contentHandler, "OWNERNAME", ownerName); @@ -714,6 +715,10 @@ public static void writeCachePoolInfo(ContentHandler contentHandler, XMLUtils.addSaxString(contentHandler, "MAXRELATIVEEXPIRY", Long.toString(maxRelativeExpiry)); } + if (defaultReplication != null) { + XMLUtils.addSaxString(contentHandler, "DEFAULTREPLICATION", + Short.toString(defaultReplication)); + } } public static CachePoolInfo readCachePoolInfo(Stanza st) @@ -736,6 +741,10 @@ public static CachePoolInfo readCachePoolInfo(Stanza st) info.setMaxRelativeExpiryMs( Long.parseLong(st.getValue("MAXRELATIVEEXPIRY"))); } + if (st.hasChildren("DEFAULTREPLICATION")) { + info.setDefaultReplication(Short.parseShort(st + .getValue("DEFAULTREPLICATION"))); + } return info; }