ReplaceDatanodeOnFailure (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.protocol.datatransfer, class: ReplaceDatanodeOnFailure

Package org.apache.hadoop.hdfs.protocol.datatransfer

# Class ReplaceDatanodeOnFailure

java.lang.Object
org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure

@Private @Evolving public class ReplaceDatanodeOnFailure extends Object
The setting of replace-datanode-on-failure feature.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ReplaceDatanodeOnFailure.Policy`
  The replacement policies

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReplaceDatanodeOnFailure(ReplaceDatanodeOnFailure.Policy policy, boolean bestEffort)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkEnabled()`
  Check if the feature is enabled.
  `static ReplaceDatanodeOnFailure`
  `get(org.apache.hadoop.conf.Configuration conf)`
  Get the setting from configuration.
  `boolean`
  `isBestEffort()`
  Best effort means that the client will try to replace the failed datanode (provided that the policy is satisfied), however, it will continue the write operation in case that the datanode replacement also fails.
  `boolean`
  `satisfy(short replication, DatanodeInfo[] existings, boolean isAppend, boolean isHflushed)`
  Does it need a replacement according to the policy?
  `String`
  `toString()`
  `static void`
  `write(ReplaceDatanodeOnFailure.Policy policy, boolean bestEffort, org.apache.hadoop.conf.Configuration conf)`
  Write the setting to configuration.

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

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

- ## Constructor Details

  - ### ReplaceDatanodeOnFailure

    public ReplaceDatanodeOnFailure(ReplaceDatanodeOnFailure.Policy policy, boolean bestEffort)

- ## Method Details

  - ### checkEnabled

    public void checkEnabled()
    Check if the feature is enabled.

  - ### isBestEffort

    public boolean isBestEffort()
    Best effort means that the client will try to replace the failed datanode (provided that the policy is satisfied), however, it will continue the write operation in case that the datanode replacement also fails.
    Returns:
      Suppose the datanode replacement fails. false: An exception should be thrown so that the write will fail. true : The write should be resumed with the remaining datandoes.

  - ### satisfy

    public boolean satisfy(short replication, DatanodeInfo[] existings, boolean isAppend, boolean isHflushed)
    Does it need a replacement according to the policy?

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### get

    public static ReplaceDatanodeOnFailure get(org.apache.hadoop.conf.Configuration conf)
    Get the setting from configuration.

  - ### write

    public static void write(ReplaceDatanodeOnFailure.Policy policy, boolean bestEffort, org.apache.hadoop.conf.Configuration conf)
    Write the setting to configuration.