HDFS-15356. Unify configuration dfs.ha.allow.stale.reads
to DFSConfigKeys. Contributed by Xiaoqiao He.
This commit is contained in:
parent
ac4a2e11d9
commit
178336f8a8
@ -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";
|
||||
|
@ -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 static List<Configuration> getConfForOtherNodes(
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4602,6 +4602,15 @@
|
||||
</description>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user