From a5c36c322baedb2f47eed2bddbfa9f065ec52e12 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Tue, 3 Dec 2013 14:14:53 +0000 Subject: [PATCH] svn merge -c 1547393 merging from trunk to branch-2 to fix: HDFS-5558. LeaseManager monitor thread can crash if the last block is complete but another block is not. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1547395 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index d83b2b6d03c..88bf04312af 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -3698,6 +3698,9 @@ Release 0.23.10 - UNRELEASED HDFS-5557. Write pipeline recovery for the last packet in the block may cause rejection of valid replicas. (kihwal) + HDFS-5558. LeaseManager monitor thread can crash if the last block is + complete but another block is not. (kihwal) + Release 0.23.9 - 2013-07-08 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index fa5cda91a97..e1bd37a7425 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -2894,6 +2894,12 @@ public class FSNamesystem implements Namesystem, FSClusterStats, } throw lee; } + // Check the state of the penultimate block. It should be completed + // before attempting to complete the last one. + if (!checkFileProgress(pendingFile, false)) { + return false; + } + // commit the last block and complete it if it has minimum replicas commitOrCompleteLastBlock(pendingFile, last); @@ -2963,7 +2969,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, // BlockInfo b = v.getPenultimateBlock(); if (b != null && !b.isComplete()) { - LOG.info("BLOCK* checkFileProgress: " + b + LOG.warn("BLOCK* checkFileProgress: " + b + " has not reached minimal replication " + blockManager.minReplication); return false;