HDFS-10693. metaSave should print blocks, not LightWeightHashSet. Contributed by Yuanbo Liu.

(cherry picked from commit 4d3af47f27)
This commit is contained in:
Konstantin V Shvachko 2016-08-07 14:29:26 -07:00
parent 8055ff1c3c
commit 6b3114a2a5
2 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.util.LightWeightHashSet; import org.apache.hadoop.hdfs.util.LightWeightHashSet;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.DFSUtil;
@ -151,7 +152,7 @@ class InvalidateBlocks {
final LightWeightHashSet<Block> blocks = entry.getValue(); final LightWeightHashSet<Block> blocks = entry.getValue();
if (blocks.size() > 0) { if (blocks.size() > 0) {
out.println(entry.getKey()); out.println(entry.getKey());
out.println(blocks); out.println(StringUtils.join(',', blocks));
} }
} }
} }

View File

@ -172,6 +172,7 @@ public class TestMetaSave {
//skip 2 lines to reach HDFS-9033 scenario. //skip 2 lines to reach HDFS-9033 scenario.
line = reader.readLine(); line = reader.readLine();
line = reader.readLine(); line = reader.readLine();
assertTrue(line.contains("blk"));
// skip 1 line for Corrupt Blocks section. // skip 1 line for Corrupt Blocks section.
line = reader.readLine(); line = reader.readLine();
line = reader.readLine(); line = reader.readLine();