Skip to content

Commit 10821d0

Browse files
author
xiezhineng
committed
fix dfs.namenode.get-blocks.check.operation's deecription and Unify the configuration of namenode and balancer for getblocks request
1 parent aff3d57 commit 10821d0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/NameNodeConnector.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ public static void checkOtherInstanceRunning(boolean toCheck) {
147147

148148
private final BalancerProtocols namenode;
149149
/**
150-
* If set requestToStandby true, Balancer will getBlocks from
150+
* If set getBlocksToStandby true, Balancer will getBlocks from
151151
* Standby NameNode only and it can reduce the performance impact of Active
152152
* NameNode, especially in a busy HA mode cluster.
153153
*/
154-
private boolean requestToStandby;
154+
private boolean getBlocksToStandby;
155155
private String nsId;
156156
private Configuration config;
157157
private final KeyManager keyManager;
@@ -191,9 +191,9 @@ public NameNodeConnector(String name, URI nameNodeUri, Path idPath,
191191

192192
this.namenode = NameNodeProxies.createProxy(conf, nameNodeUri,
193193
BalancerProtocols.class, fallbackToSimpleAuth).getProxy();
194-
this.requestToStandby = conf.getBoolean(
195-
DFSConfigKeys.DFS_HA_ALLOW_STALE_READ_KEY,
196-
DFSConfigKeys.DFS_HA_ALLOW_STALE_READ_DEFAULT);
194+
this.getBlocksToStandby = !conf.getBoolean(
195+
DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_KEY,
196+
DFSConfigKeys.DFS_NAMENODE_GETBLOCKS_CHECK_OPERATION_DEFAULT);
197197
this.config = conf;
198198

199199
this.fs = (DistributedFileSystem)FileSystem.get(nameNodeUri, conf);
@@ -318,7 +318,7 @@ public DatanodeStorageReport[] getLiveDatanodeStorageReport()
318318
private ProxyPair getProxy() throws IOException {
319319
boolean isRequestStandby = false;
320320
ClientProtocol clientProtocol = null;
321-
if (requestToStandby && nsId != null
321+
if (getBlocksToStandby && nsId != null
322322
&& HAUtil.isHAEnabled(config, nsId)) {
323323
List<ClientProtocol> namenodes =
324324
HAUtil.getProxiesForAllNameNodesInNameservice(config, nsId);

hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,8 +4123,8 @@
41234123
<name>dfs.namenode.get-blocks.check.operation</name>
41244124
<value>true</value>
41254125
<description>
4126-
Whether enable checkOperation when call getBlocks.
4127-
It is enabled (true) by default.
4126+
Set false to disable checkOperation and getBlocks for Balancer
4127+
will route to Standby NameNode for HA mode setup.
41284128
</description>
41294129
</property>
41304130
<property>

0 commit comments

Comments
 (0)