From bbafbced87e013cc4dda0f34bbf1d1d99a92a3f3 Mon Sep 17 00:00:00 2001 From: Konstantin Shvachko Date: Thu, 6 Jun 2013 20:45:56 +0000 Subject: [PATCH] HDFS-4867. metaSave NPEs when there are invalid blocks in repl queue. Contributed by Plamen Jeliazkov and Ravi Prakash. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1490434 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index faeb6a2008d..8e265f86ce5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2928,6 +2928,9 @@ Release 0.23.9 - UNRELEASED BUG FIXES + HDFS-4867. metaSave NPEs when there are invalid blocks in repl queue. + (Plamen Jeliazkov and Ravi Prakash via shv) + Release 0.23.8 - 2013-06-05 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 0a6305ff3c1..132ca68e03d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -458,7 +458,8 @@ public class BlockManager { numReplicas.decommissionedReplicas(); if (block instanceof BlockInfo) { - String fileName = ((BlockInfo)block).getBlockCollection().getName(); + BlockCollection bc = ((BlockInfo) block).getBlockCollection(); + String fileName = (bc == null) ? "[orphaned]" : bc.getName(); out.print(fileName + ": "); } // l: == live:, d: == decommissioned c: == corrupt e: == excess