From f65dc6ee952d63b80766e1a3a298558443678ae9 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Fri, 21 Jul 2017 21:13:20 +0800 Subject: [PATCH] HDFS-12177. NameNode exits due to setting BlockPlacementPolicy loglevel to Debug. Contributed by Jiandan Yang. --- .../server/blockmanagement/BlockPlacementPolicyDefault.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java index 91ba598ecaf..d688ee1c7b0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java @@ -718,7 +718,7 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy { } Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode " + chosenNode + " is already in excludedNodes " + excludedNodes); - if (LOG.isDebugEnabled()) { + if (LOG.isDebugEnabled() && builder != null) { builder.append("\nNode ").append(NodeBase.getPath(chosenNode)) .append(" ["); } @@ -747,7 +747,7 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy { } } - if (LOG.isDebugEnabled()) { + if (LOG.isDebugEnabled() && builder != null) { builder.append("\n]"); }