HDFS-5558. LeaseManager monitor thread can crash if the last block is complete but another block is not. Contributed by Kihwal Lee.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1547393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-12-03 14:12:43 +00:00
parent 9b08654536
commit 7af12ab207
2 changed files with 10 additions and 1 deletions

View File

@ -4063,6 +4063,9 @@ Release 0.23.10 - UNRELEASED
HDFS-5557. Write pipeline recovery for the last packet in the block may HDFS-5557. Write pipeline recovery for the last packet in the block may
cause rejection of valid replicas. (kihwal) 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 Release 0.23.9 - 2013-07-08
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -2933,6 +2933,12 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
} }
throw lee; 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 // commit the last block and complete it if it has minimum replicas
commitOrCompleteLastBlock(pendingFile, last); commitOrCompleteLastBlock(pendingFile, last);
@ -3002,7 +3008,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
// //
BlockInfo b = v.getPenultimateBlock(); BlockInfo b = v.getPenultimateBlock();
if (b != null && !b.isComplete()) { if (b != null && !b.isComplete()) {
LOG.info("BLOCK* checkFileProgress: " + b LOG.warn("BLOCK* checkFileProgress: " + b
+ " has not reached minimal replication " + " has not reached minimal replication "
+ blockManager.minReplication); + blockManager.minReplication);
return false; return false;