Repository: hadoop Updated Branches: refs/heads/YARN-1197 f86eae17d -> f1f930e4b (forced update)
HDFS-8384. Allow NN to startup if there are files having a lease but are not under construction. Contributed by Jing Zhao. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8928729c Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8928729c Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8928729c Branch: refs/heads/YARN-1197 Commit: 8928729c80af0a154524e06fb13ed9b191986a78 Parents: d16c4ee Author: Jing Zhao <[email protected]> Authored: Fri Sep 4 11:42:22 2015 -0700 Committer: Jing Zhao <[email protected]> Committed: Fri Sep 4 11:42:22 2015 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 5 ++++- .../org/apache/hadoop/hdfs/server/namenode/LeaseManager.java | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8928729c/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index e67c9d5..b1e53da 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -891,6 +891,9 @@ Release 2.8.0 - UNRELEASED HDFS-9012. Move o.a.h.hdfs.protocol.datatransfer.PipelineAck class to hadoop-hdfs-client module. (Mingliang Liu via wheat9) + HDFS-8384. Allow NN to startup if there are files having a lease but are not + under construction. (jing9) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than http://git-wip-us.apache.org/repos/asf/hadoop/blob/8928729c/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- 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 adcb1d6..25b6928 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 @@ -3184,7 +3184,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, assert hasWriteLock(); FileUnderConstructionFeature uc = pendingFile.getFileUnderConstructionFeature(); - Preconditions.checkArgument(uc != null); + if (uc == null) { + throw new IOException("Cannot finalize file " + src + + " because it is not under construction"); + } leaseManager.removeLease(uc.getClientName(), pendingFile); pendingFile.recordModification(latestSnapshot); http://git-wip-us.apache.org/repos/asf/hadoop/blob/8928729c/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java index 1a1edaf..7cd6f3d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java @@ -108,7 +108,11 @@ public class LeaseManager { long numUCBlocks = 0; for (Long id : getINodeIdWithLeases()) { final INodeFile cons = fsnamesystem.getFSDirectory().getInode(id).asFile(); - Preconditions.checkState(cons.isUnderConstruction()); + if (!cons.isUnderConstruction()) { + LOG.warn("The file " + cons.getFullPathName() + + " is not under construction but has lease."); + continue; + } BlockInfo[] blocks = cons.getBlocks(); if(blocks == null) { continue;
