Skip to content

Commit ac95877

Browse files
authored
HDFS-16813. Remove parameter validation logic such as dfs.namenode.decommission.blocks.per.interval in DatanodeAdminManager#activate (#5063)
1 parent 7cb22eb commit ac95877

3 files changed

Lines changed: 14 additions & 32 deletions

File tree

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminDefaultMonitor.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ protected void processConf() {
114114
numBlocksPerCheck =
115115
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_DEFAULT;
116116
}
117+
118+
final String deprecatedKey = "dfs.namenode.decommission.nodes.per.interval";
119+
final String strNodes = conf.get(deprecatedKey);
120+
if (strNodes != null) {
121+
LOG.warn("Deprecated configuration key {} will be ignored.", deprecatedKey);
122+
LOG.warn("Please update your configuration to use {} instead.",
123+
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_KEY);
124+
}
125+
117126
LOG.info("Initialized the Default Decommission and Maintenance monitor");
118127
}
119128

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminManager.java

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -108,32 +108,6 @@ void activate(Configuration conf) {
108108
Preconditions.checkArgument(intervalSecs >= 0, "Cannot set a negative " +
109109
"value for " + DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY);
110110

111-
int blocksPerInterval = conf.getInt(
112-
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_KEY,
113-
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_DEFAULT);
114-
115-
final String deprecatedKey =
116-
"dfs.namenode.decommission.nodes.per.interval";
117-
final String strNodes = conf.get(deprecatedKey);
118-
if (strNodes != null) {
119-
LOG.warn("Deprecated configuration key {} will be ignored.",
120-
deprecatedKey);
121-
LOG.warn("Please update your configuration to use {} instead.",
122-
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_KEY);
123-
}
124-
125-
Preconditions.checkArgument(blocksPerInterval > 0,
126-
"Must set a positive value for "
127-
+ DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_BLOCKS_PER_INTERVAL_KEY);
128-
129-
final int maxConcurrentTrackedNodes = conf.getInt(
130-
DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_MAX_CONCURRENT_TRACKED_NODES,
131-
DFSConfigKeys
132-
.DFS_NAMENODE_DECOMMISSION_MAX_CONCURRENT_TRACKED_NODES_DEFAULT);
133-
Preconditions.checkArgument(maxConcurrentTrackedNodes >= 0,
134-
"Cannot set a negative value for "
135-
+ DFSConfigKeys.DFS_NAMENODE_DECOMMISSION_MAX_CONCURRENT_TRACKED_NODES);
136-
137111
Class cls = null;
138112
try {
139113
cls = conf.getClass(
@@ -152,12 +126,7 @@ void activate(Configuration conf) {
152126
executor.scheduleWithFixedDelay(monitor, intervalSecs, intervalSecs,
153127
TimeUnit.SECONDS);
154128

155-
if (LOG.isDebugEnabled()) {
156-
LOG.debug("Activating DatanodeAdminManager with interval {} seconds, " +
157-
"{} max blocks per interval, " +
158-
"{} max concurrently tracked nodes.", intervalSecs,
159-
blocksPerInterval, maxConcurrentTrackedNodes);
160-
}
129+
LOG.debug("Activating DatanodeAdminManager with interval {} seconds.", intervalSecs);
161130
}
162131

163132
/**

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminMonitorBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public void setConf(Configuration conf) {
123123
DFSConfigKeys
124124
.DFS_NAMENODE_DECOMMISSION_MAX_CONCURRENT_TRACKED_NODES_DEFAULT;
125125
}
126+
127+
LOG.debug("Activating DatanodeAdminMonitor with {} max concurrently tracked nodes.",
128+
maxConcurrentTrackedNodes);
129+
126130
processConf();
127131
}
128132

0 commit comments

Comments
 (0)