Class NameNodeProxiesClient

java.lang.Object
org.apache.hadoop.hdfs.NameNodeProxiesClient

@Private public class NameNodeProxiesClient extends Object
Create proxy objects with ClientProtocol and HAServiceProtocol to communicate with a remote NN. For the former, generally use createProxyWithClientProtocol(Configuration, URI, AtomicBoolean), which will create either an HA- or non-HA-enabled client proxy as appropriate. For creating proxy objects with other protocols, please see NameNodeProxies#createProxy(Configuration, URI, Class).
  • Constructor Details

    • NameNodeProxiesClient

      public NameNodeProxiesClient()
  • Method Details

    • createProxyWithClientProtocol

      public static NameNodeProxiesClient.ProxyAndInfo<ClientProtocol> createProxyWithClientProtocol(org.apache.hadoop.conf.Configuration conf, URI nameNodeUri, AtomicBoolean fallbackToSimpleAuth) throws IOException
      Creates the namenode proxy with the ClientProtocol. This will handle creation of either HA- or non-HA-enabled proxy objects, depending upon if the provided URI is a configured logical URI.
      Parameters:
      conf - the configuration containing the required IPC properties, client failover configurations, etc.
      nameNodeUri - the URI pointing either to a specific NameNode or to a logical nameservice.
      fallbackToSimpleAuth - set to true or false during calls to indicate if a secure client falls back to simple auth
      Returns:
      an object containing both the proxy and the associated delegation token service it corresponds to
      Throws:
      IOException - if there is an error creating the proxy
    • createProxyWithLossyRetryHandler

      public static <T> NameNodeProxiesClient.ProxyAndInfo<T> createProxyWithLossyRetryHandler(org.apache.hadoop.conf.Configuration config, URI nameNodeUri, Class<T> xface, int numResponseToDrop, AtomicBoolean fallbackToSimpleAuth) throws IOException
      Generate a dummy namenode proxy instance that utilizes our hacked LossyRetryInvocationHandler. Proxy instance generated using this method will proactively drop RPC responses. Currently this method only support HA setup. null will be returned if the given configuration is not for HA.
      Parameters:
      config - the configuration containing the required IPC properties, client failover configurations, etc.
      nameNodeUri - the URI pointing either to a specific NameNode or to a logical nameservice.
      xface - the IPC interface which should be created
      numResponseToDrop - The number of responses to drop for each RPC call
      fallbackToSimpleAuth - set to true or false during calls to indicate if a secure client falls back to simple auth
      Returns:
      an object containing both the proxy and the associated delegation token service it corresponds to. Will return null of the given configuration does not support HA.
      Throws:
      IOException - if there is an error creating the proxy
    • createFailoverProxyProvider

      @VisibleForTesting public static <T> AbstractNNFailoverProxyProvider<T> createFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf, URI nameNodeUri, Class<T> xface, boolean checkPort, AtomicBoolean fallbackToSimpleAuth) throws IOException
      Creates the Failover proxy provider instance
      Throws:
      IOException
    • createFailoverProxyProvider

      protected static <T> AbstractNNFailoverProxyProvider<T> createFailoverProxyProvider(org.apache.hadoop.conf.Configuration conf, URI nameNodeUri, Class<T> xface, boolean checkPort, AtomicBoolean fallbackToSimpleAuth, HAProxyFactory<T> proxyFactory) throws IOException
      Throws:
      IOException
    • getFailoverProxyProviderClass

      @VisibleForTesting public static <T> Class<org.apache.hadoop.io.retry.FailoverProxyProvider<T>> getFailoverProxyProviderClass(org.apache.hadoop.conf.Configuration conf, URI nameNodeUri) throws IOException
      Gets the configured Failover proxy provider's class
      Throws:
      IOException
    • createHAProxy

      public static <T> NameNodeProxiesClient.ProxyAndInfo<T> createHAProxy(org.apache.hadoop.conf.Configuration conf, URI nameNodeUri, Class<T> xface, AbstractNNFailoverProxyProvider<T> failoverProxyProvider)
      Creates an explicitly HA-enabled proxy object.
      Parameters:
      conf - the configuration object
      nameNodeUri - the URI pointing either to a specific NameNode or to a logical nameservice.
      xface - the IPC interface which should be created
      failoverProxyProvider - Failover proxy provider
      Returns:
      an object containing both the proxy and the associated delegation token service it corresponds to
    • createNonHAProxyWithClientProtocol

      public static ClientProtocol createNonHAProxyWithClientProtocol(InetSocketAddress address, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.UserGroupInformation ugi, boolean withRetries, AtomicBoolean fallbackToSimpleAuth) throws IOException
      Throws:
      IOException
    • createProxyWithAlignmentContext

      public static ClientProtocol createProxyWithAlignmentContext(InetSocketAddress address, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.UserGroupInformation ugi, boolean withRetries, AtomicBoolean fallbackToSimpleAuth, org.apache.hadoop.ipc.AlignmentContext alignmentContext) throws IOException
      Throws:
      IOException