ObserverReadProxyProvider (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.namenode.ha, class: ObserverReadProxyProvider

Package org.apache.hadoop.hdfs.server.namenode.ha

# Class ObserverReadProxyProvider<T>

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider<T>
org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider<T>

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `org.apache.hadoop.io.retry.FailoverProxyProvider<T>`

Direct Known Subclasses:
  `ObserverReadProxyProviderWithIPFailover`

@Private @Evolving public class ObserverReadProxyProvider<T> extends AbstractNNFailoverProxyProvider<T>
A `FailoverProxyProvider` implementation that supports reading from observer namenode(s). This constructs a wrapper proxy that sends the request to observer namenode(s), if observer read is enabled. In case there are multiple observer namenodes, it will try them one by one in case the RPC failed. It will fail back to the active namenode after it has exhausted all the observer namenodes. Read and write requests will still be sent to active NN if reading from observer is turned off.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

  `AbstractNNFailoverProxyProvider.NNProxyInfo<T>`

  ## Nested classes/interfaces inherited from interface org.apache.hadoop.io.retry.FailoverProxyProvider

  `org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T extends Object>`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

  `conf, factory, fallbackToSimpleAuth, ugi, xface`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObserverReadProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory)`
  By default ObserverReadProxyProvider uses `ConfiguredFailoverProxyProvider` for failover.
  `ObserverReadProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory, AbstractNNFailoverProxyProvider<T> failoverProxy)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `org.apache.hadoop.ipc.AlignmentContext`
  `getAlignmentContext()`
  `org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T>`
  `getProxy()`
  `void`
  `performFailover(T currentProxy)`
  `boolean`
  `useLogicalURI()`
  Inquire whether logical HA URI is used for the implementation.

  ### Methods inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider

  `createProxyIfNeeded, getFallbackToSimpleAuth, getInterface, getProxyAddresses, getRandomOrder, setFallbackToSimpleAuth`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ObserverReadProxyProvider

    public ObserverReadProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory)
    By default ObserverReadProxyProvider uses `ConfiguredFailoverProxyProvider` for failover.

  - ### ObserverReadProxyProvider

    public ObserverReadProxyProvider(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory, AbstractNNFailoverProxyProvider<T> failoverProxy)

- ## Method Details

  - ### getAlignmentContext

    public org.apache.hadoop.ipc.AlignmentContext getAlignmentContext()

  - ### getProxy

    public org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T> getProxy()

  - ### performFailover

    public void performFailover(T currentProxy)

  - ### close

    public void close() throws IOException
    Throws:
      `IOException`

  - ### useLogicalURI

    public boolean useLogicalURI()
    Description copied from class: `AbstractNNFailoverProxyProvider`
    Inquire whether logical HA URI is used for the implementation. If it is used, a special token handling may be needed to make sure a token acquired from a node in the HA pair can be used against the other node.
    Specified by:
      `useLogicalURI` in class `AbstractNNFailoverProxyProvider<T>`
    Returns:
      true if logical HA URI is used. false, if not used.