HDFS-7570. SecondaryNameNode need twice memory when calling reloadFromImageFile. Contributed by zhaoyunjiong.
(cherry picked from commit 85aec75ce53445e1abf840076d2e10f1e3c6d69b) (cherry picked from commit 27eecaef10feb49c4160ad289fd301bba6608973) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c3928b30 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c3928b30 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c3928b30 Branch: refs/heads/branch-2.6 Commit: c3928b3068ab117f92d22ef7e4b99ea36a546e49 Parents: 3353707 Author: cnauroth <cnaur...@apache.org> Authored: Tue Jan 13 16:10:28 2015 -0800 Committer: Vinod Kumar Vavilapalli <vino...@apache.org> Committed: Tue Sep 8 17:21:58 2015 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 5 +++++ .../apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java | 6 +++++- .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/c3928b30/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 eaaea5d..9bc7974 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -169,6 +169,9 @@ Release 2.6.1 - UNRELEASED HDFS-8846. Add a unit test for INotify functionality across a layout version upgrade (Zhe Zhang via Colin P. McCabe) + HDFS-7470. SecondaryNameNode need twice memory when calling + reloadFromImageFile. (zhaoyunjiong via cnauroth) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/c3928b30/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java ---------------------------------------------------------------------- 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 846bc92..2f9d29b 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 @@ -3811,4 +3811,9 @@ public class BlockManager { stopReplicationInitializer(); blocksMap.close(); } + + public void clear() { + clearQueues(); + blocksMap.clear(); + } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/c3928b30/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java index a675635..fafdc46 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlocksMap.java @@ -85,9 +85,13 @@ class BlocksMap { void close() { + clear(); + blocks = null; + } + + void clear() { if (blocks != null) { blocks.clear(); - blocks = null; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/c3928b30/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 362b147..bd4f555 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 @@ -651,6 +651,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, snapshotManager.clearSnapshottableDirs(); cacheManager.clear(); setImageLoaded(false); + blockManager.clear(); } @VisibleForTesting