From 8f55bb8a1d5c7e1405dd74a15b1e387a7d8688ab Mon Sep 17 00:00:00 2001 From: "jinbiao.sun" Date: Sat, 3 Sep 2022 15:41:58 +0800 Subject: [PATCH] HDFS-16524. Recover the original config dfs.namenode.block.deletion.increment --- .../main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java | 4 ++++ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 8 ++++++++ .../hadoop-hdfs/src/main/resources/hdfs-default.xml | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java index 4a24590a25c..8e405ac09b3 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java @@ -495,6 +495,10 @@ public class DFSConfigKeys extends CommonConfigurationKeys { public static final int DFS_NAMENODE_BLOCK_DELETION_UNLOCK_INTERVAL_MS_DEFAULT = 10; + /** Block deletion increment. */ + public static final String DFS_NAMENODE_BLOCK_DELETION_INCREMENT_KEY = + "dfs.namenode.block.deletion.increment"; + public static final int DFS_NAMENODE_BLOCK_DELETION_INCREMENT_DEFAULT = 1000; /** Block deletion asynchronous. */ public static final String DFS_NAMENODE_BLOCK_DELETION_ASYNC_KEY = "dfs.namenode.block.deletion.async"; public static final boolean DFS_NAMENODE_BLOCK_DELETION_ASYNC_DEFAULT = true; 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 f466bf0aee4..95a8cca87d7 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 @@ -501,6 +501,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, private final String supergroup; private final boolean standbyShouldCheckpoint; private final boolean isSnapshotTrashRootEnabled; + private final boolean blockDeletionAsync; + private final int blockDeletionIncrement; private final int snapshotDiffReportLimit; /** @@ -1064,6 +1066,12 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, this.allowOwnerSetQuota = conf.getBoolean( DFSConfigKeys.DFS_PERMISSIONS_ALLOW_OWNER_SET_QUOTA_KEY, DFSConfigKeys.DFS_PERMISSIONS_ALLOW_OWNER_SET_QUOTA_DEFAULT); + this.blockDeletionAsync = conf.getBoolean( + DFSConfigKeys.DFS_NAMENODE_BLOCK_DELETION_ASYNC_KEY, + DFSConfigKeys.DFS_NAMENODE_BLOCK_DELETION_ASYNC_DEFAULT); + this.blockDeletionIncrement = conf.getInt( + DFSConfigKeys.DFS_NAMENODE_BLOCK_DELETION_INCREMENT_KEY, + DFSConfigKeys.DFS_NAMENODE_BLOCK_DELETION_INCREMENT_DEFAULT); this.isGetBlocksCheckOperationEnabled = conf.getBoolean( DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_KEY, DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_DEFAULT); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml index 7b25f28a3f5..15a64db8197 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml @@ -6165,9 +6165,9 @@ dfs.namenode.block.deletion.async - false + true - If true, enable block deleting asynchronously + If false, disable block deleting asynchronously