HDFS-14142. Move ipfailover config key out of HdfsClientConfigKeys. Contributed by Chen Liang.

This commit is contained in:
Chen Liang 2018-12-12 10:39:39 -08:00 committed by Konstantin V Shvachko
parent 2904aa3808
commit b8ad6c85a5
2 changed files with 5 additions and 7 deletions

View File

@ -192,9 +192,6 @@ public interface HdfsClientConfigKeys {
String DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS = String DFS_PROVIDED_ALIASMAP_INMEMORY_RPC_ADDRESS =
"dfs.provided.aliasmap.inmemory.dnrpc-address"; "dfs.provided.aliasmap.inmemory.dnrpc-address";
String DFS_CLIENT_FAILOVER_IPFAILOVER_VIRTUAL_ADDRESS =
Failover.PREFIX + "ipfailover.virtual-address";
/** /**
* These are deprecated config keys to client code. * These are deprecated config keys to client code.
*/ */

View File

@ -22,13 +22,12 @@
import java.util.Collections; import java.util.Collections;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
import org.apache.hadoop.hdfs.HAUtilClient; import org.apache.hadoop.hdfs.HAUtilClient;
import org.apache.hadoop.hdfs.protocol.ClientProtocol; import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_FAILOVER_IPFAILOVER_VIRTUAL_ADDRESS;
/** /**
* Extends {@link ObserverReadProxyProvider} to support NameNode IP failover. * Extends {@link ObserverReadProxyProvider} to support NameNode IP failover.
* *
@ -81,6 +80,9 @@ public class ObserverReadProxyProviderWithIPFailover<T extends ClientProtocol>
private static final Logger LOG = LoggerFactory.getLogger( private static final Logger LOG = LoggerFactory.getLogger(
ObserverReadProxyProviderWithIPFailover.class); ObserverReadProxyProviderWithIPFailover.class);
private static final String IPFAILOVER_CONFIG_PREFIX =
HdfsClientConfigKeys.Failover.PREFIX + "ipfailover.virtual-address";
/** /**
* By default ObserverReadProxyProviderWithIPFailover * By default ObserverReadProxyProviderWithIPFailover
* uses {@link IPFailoverProxyProvider} for failover. * uses {@link IPFailoverProxyProvider} for failover.
@ -123,8 +125,7 @@ private void cloneDelegationTokenForVirtualIP(
private static URI getFailoverVirtualIP( private static URI getFailoverVirtualIP(
Configuration conf, String nameServiceID) { Configuration conf, String nameServiceID) {
String configKey = DFS_CLIENT_FAILOVER_IPFAILOVER_VIRTUAL_ADDRESS String configKey = IPFAILOVER_CONFIG_PREFIX + "." + nameServiceID;
+ "." + nameServiceID;
String virtualIP = conf.get(configKey); String virtualIP = conf.get(configKey);
LOG.info("Name service ID {} will use virtual IP {} for failover", LOG.info("Name service ID {} will use virtual IP {} for failover",
nameServiceID, virtualIP); nameServiceID, virtualIP);