Author: kihwal Date: Tue Dec 3 14:12:43 2013 New Revision: 1547393 URL: http://svn.apache.org/r1547393 Log: HDFS-5558. LeaseManager monitor thread can crash if the last block is complete but another block is not. Contributed by Kihwal Lee.
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1547393&r1=1547392&r2=1547393&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue Dec 3 14:12:43 2013 @@ -4063,6 +4063,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 Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1547393&r1=1547392&r2=1547393&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Tue Dec 3 14:12:43 2013 @@ -2933,6 +2933,12 @@ public class FSNamesystem implements Nam } 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); @@ -3002,7 +3008,7 @@ public class FSNamesystem implements Nam // 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;