diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 438ed6663e4..47eea752df5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -671,6 +671,9 @@ Release 2.6.0 - UNRELEASED HDFS-7230. Add rolling downgrade documentation. (szetszwo via jing9) + HDFS-6385. Show when block deletion will start after NameNode startup in + WebUI. (cnauroth) + OPTIMIZATIONS HDFS-6690. Deduplicate xattr names in memory. (wang) 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 ecc0a4a1e35..94e1c20521f 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 @@ -121,6 +121,7 @@ public class BlockManager { private volatile long scheduledReplicationBlocksCount = 0L; private final AtomicLong excessBlocksCount = new AtomicLong(0L); private final AtomicLong postponedMisreplicatedBlocksCount = new AtomicLong(0L); + private final long startupDelayBlockDeletionInMs; /** Used by metrics */ public long getPendingReplicationBlocksCount() { @@ -143,6 +144,10 @@ public class BlockManager { return invalidateBlocks.numBlocks(); } /** Used by metrics */ + public long getStartupDelayBlockDeletionInMs() { + return startupDelayBlockDeletionInMs; + } + /** Used by metrics */ public long getExcessBlocksCount() { return excessBlocksCount.get(); } @@ -266,11 +271,11 @@ public class BlockManager { datanodeManager = new DatanodeManager(this, namesystem, conf); heartbeatManager = datanodeManager.getHeartbeatManager(); - final long pendingPeriod = conf.getLong( + startupDelayBlockDeletionInMs = conf.getLong( DFSConfigKeys.DFS_NAMENODE_STARTUP_DELAY_BLOCK_DELETION_SEC_KEY, DFSConfigKeys.DFS_NAMENODE_STARTUP_DELAY_BLOCK_DELETION_SEC_DEFAULT) * 1000L; invalidateBlocks = new InvalidateBlocks( - datanodeManager.blockInvalidateLimit, pendingPeriod); + datanodeManager.blockInvalidateLimit, startupDelayBlockDeletionInMs); // Compute the map capacity by allocating 2% of total memory blocksMap = new BlocksMap( 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 8f56a99e66e..93ff63e1b05 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 @@ -6581,6 +6581,11 @@ public class FSNamesystem implements Namesystem, FSClusterStats, return blockManager.getPendingDeletionBlocksCount(); } + @Override + public long getBlockDeletionStartTime() { + return startTime + blockManager.getStartupDelayBlockDeletionInMs(); + } + @Metric public long getExcessBlocks() { return blockManager.getExcessBlocksCount(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java index 587746df154..708591b45ea 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMBean.java @@ -152,6 +152,12 @@ public interface FSNamesystemMBean { */ long getPendingDeletionBlocks(); + /** + * Time when block deletions will begin + * @return time when block deletions will begin + */ + long getBlockDeletionStartTime(); + /** * Number of content stale storages. * @return number of content stale storages diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html index 7798cba65f3..4971e90e093 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html @@ -170,6 +170,7 @@