From 87d0133703ccfaa68dddbc78f026276c6cb389c8 Mon Sep 17 00:00:00 2001 From: Colin Patrick Mccabe Date: Mon, 24 Aug 2015 11:31:56 -0700 Subject: [PATCH] HDFS-8930. Block report lease may leak if the 2nd full block report comes when NN is still in safemode (Colin P. McCabe via Jing Zhao) (cherry picked from commit b5ce87f84d9de0a5347ab38c0567a5a70d1fbfd7) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 1 + .../server/blockmanagement/TestBlockReportRateLimiting.java | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 241540faf4c..a52367bc093 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -857,6 +857,9 @@ Release 2.8.0 - UNRELEASED HDFS-8942. Update hyperlink to rack awareness page in HDFS Architecture documentation. (Masatake Iwasaki via aajisaka) + HDFS-8930. Block report lease may leak if the 2nd full block report comes + when NN is still in safemode (Colin P. McCabe via Jing Zhao) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES 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 ce6bcc7ddd8..c45ecc12970 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 @@ -1838,6 +1838,7 @@ public class BlockManager implements BlockStatsMXBean { blockLog.info("BLOCK* processReport: " + "discarded non-initial block report from {}" + " because namenode still in startup phase", nodeID); + blockReportLeaseManager.removeLease(node); return !node.hasStaleStorages(); } if (context != null) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportRateLimiting.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportRateLimiting.java index 86a7511b840..3cc1b026ade 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportRateLimiting.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockReportRateLimiting.java @@ -29,7 +29,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.DatanodeID; -import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.protocol.BlockReportContext; import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; @@ -40,7 +39,6 @@ import org.junit.Test; import java.io.IOException; import java.util.HashSet; -import java.util.List; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference;