You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2020/05/16 11:09:29 UTC
[hadoop] branch trunk updated: HDFS-15356. Unify configuration
`dfs.ha.allow.stale.reads` to DFSConfigKeys. Contributed by Xiaoqiao He.
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 178336f HDFS-15356. Unify configuration `dfs.ha.allow.stale.reads` to DFSConfigKeys. Contributed by Xiaoqiao He.
178336f is described below
commit 178336f8a8bb291eb355bede729082f2f0382216
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Sat May 16 16:35:06 2020 +0530
HDFS-15356. Unify configuration `dfs.ha.allow.stale.reads` to DFSConfigKeys. Contributed by Xiaoqiao He.
---
.../src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java | 3 +++
.../hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java | 7 +++++--
.../hadoop-hdfs/src/main/resources/hdfs-default.xml | 9 +++++++++
3 files changed, 17 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 722f414..f4bf33a 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
@@ -1164,6 +1164,9 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
"dfs.ha.nn.not-become-active-in-safemode";
public static final boolean DFS_HA_NN_NOT_BECOME_ACTIVE_IN_SAFEMODE_DEFAULT =
false;
+ public static final String DFS_HA_ALLOW_STALE_READ_KEY =
+ "dfs.ha.allow.stale.reads";
+ public static final boolean DFS_HA_ALLOW_STALE_READ_DEFAULT = false;
// Security-related configs
public static final String DFS_ENCRYPT_DATA_TRANSFER_KEY = "dfs.encrypt.data.transfer";
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java
index aebc28a..43e76c7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HAUtil.java
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hdfs;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_HA_ALLOW_STALE_READ_DEFAULT;
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_HA_ALLOW_STALE_READ_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_HA_NAMENODE_ID_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY;
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_HTTPS_BIND_HOST_KEY;
@@ -220,11 +222,12 @@ public class HAUtil {
* @return true if the NN should allow read operations while in standby mode.
*/
public static boolean shouldAllowStandbyReads(Configuration conf) {
- return conf.getBoolean("dfs.ha.allow.stale.reads", false);
+ return conf.getBoolean(DFS_HA_ALLOW_STALE_READ_KEY,
+ DFS_HA_ALLOW_STALE_READ_DEFAULT);
}
public static void setAllowStandbyReads(Configuration conf, boolean val) {
- conf.setBoolean("dfs.ha.allow.stale.reads", val);
+ conf.setBoolean(DFS_HA_ALLOW_STALE_READ_KEY, val);
}
/**
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 5c48b18..33d8163 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
@@ -4603,6 +4603,15 @@
</property>
<property>
+ <name>dfs.ha.allow.stale.reads</name>
+ <value>false</value>
+ <description>
+ If true, a NameNode in Standby state can process read request and the result
+ could be stale.
+ </description>
+</property>
+
+<property>
<name>dfs.journalnode.edits.dir</name>
<value>/tmp/hadoop/dfs/journalnode/</value>
<description>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org