DataNodeFaultInjector (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.datanode, class: DataNodeFaultInjector

Package org.apache.hadoop.hdfs.server.datanode

# Class DataNodeFaultInjector

java.lang.Object
org.apache.hadoop.hdfs.server.datanode.DataNodeFaultInjector

@VisibleForTesting @Private public class DataNodeFaultInjector extends Object
Used for injecting faults in DFSClient and DFSOutputStream tests. Calls into this are a no-op in production code.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataNodeFaultInjector()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `badDecoding(ByteBuffer[] outputs)`
  Used as a hook to inject data pollution into an erasure coding reconstruction.
  `void`
  `blockUtilSendFullBlockReport()`
  Used as a hook to inject intercept when re-register.
  `void`
  `delay()`
  Just delay a while.
  `void`
  `delayAckLastPacket()`
  Used as a hook to delay sending the response of the last packet.
  `void`
  `delayBlockReader()`
  Used as a hook to inject latency when read block in erasure coding reconstruction process.
  `void`
  `delayDeleteReplica()`
  Just delay delete replica a while.
  `void`
  `delayDiffRecord()`
  Just delay run diff record a while.
  `void`
  `delayGetMetaDataInputStream()`
  Just delay getMetaDataInputStream a while.
  `void`
  `delaySendingAckToUpstream(String upstreamAddr)`
  `void`
  `delayWhenOfferServiceHoldLock()`
  Used as a hook to inject intercept when BPOfferService hold lock.
  `void`
  `delayWriteToDisk()`
  Used as a hook to delay writing a packet to disk.
  `void`
  `delayWriteToOsCache()`
  Used as a hook to delay writing a packet to os cache.
  `boolean`
  `dropHeartbeatPacket()`
  `void`
  `endOfferService()`
  `void`
  `failMirrorConnection()`
  `void`
  `failPipeline(ReplicaInPipeline replicaInfo, String mirrorAddr)`
  `static DataNodeFaultInjector`
  `get()`
  `void`
  `getHdfsBlocksMetadata()`
  `void`
  `interceptBlockReader()`
  Used as a hook to inject intercept When finish reading from block.
  `void`
  `interceptFreeBlockReaderBuffer()`
  Used as a hook to inject intercept when free the block reader buffer.
  `void`
  `logDelaySendingAckToUpstream(String upstreamAddr, long delayMs)`
  Used as a hook to intercept the latency of sending ack.
  `void`
  `logDelaySendingPacketDownstream(String mirrAddr, long delayMs)`
  Used as a hook to intercept the latency of sending packet.
  `void`
  `markSlow(String dnAddr, int[] replies)`
  `void`
  `noRegistration()`
  `void`
  `sendShortCircuitShmResponse()`
  `static void`
  `set(DataNodeFaultInjector injector)`
  `void`
  `startOfferService()`
  `void`
  `stopSendingPacketDownstream(String mirrAddr)`
  `void`
  `stripedBlockChecksumReconstruction()`
  Used as a hook to inject failure in erasure coding checksum reconstruction process.
  `void`
  `stripedBlockReconstruction()`
  Used as a hook to inject failure in erasure coding reconstruction process.
  `void`
  `throwTooManyOpenFiles()`
  `void`
  `waitUntilStorageRemoved()`
  Used in `DirectoryScanner.reconcile()` to wait until a storage is removed, leaving a stale copy of `DirectoryScanner.diffs`.
  `void`
  `writeBlockAfterFlush()`

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

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

- ## Constructor Details

  - ### DataNodeFaultInjector

    public DataNodeFaultInjector()

- ## Method Details

  - ### get

    public static DataNodeFaultInjector get()

  - ### set

    public static void set(DataNodeFaultInjector injector)

  - ### getHdfsBlocksMetadata

    public void getHdfsBlocksMetadata()

  - ### writeBlockAfterFlush

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

  - ### sendShortCircuitShmResponse

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

  - ### dropHeartbeatPacket

    public boolean dropHeartbeatPacket()

  - ### stopSendingPacketDownstream

    public void stopSendingPacketDownstream(String mirrAddr) throws IOException
    Throws:
      `IOException`

  - ### logDelaySendingPacketDownstream

    public void logDelaySendingPacketDownstream(String mirrAddr, long delayMs) throws IOException
    Used as a hook to intercept the latency of sending packet.
    Throws:
      `IOException`

  - ### delaySendingAckToUpstream

    public void delaySendingAckToUpstream(String upstreamAddr) throws IOException
    Throws:
      `IOException`

  - ### delayAckLastPacket

    public void delayAckLastPacket() throws IOException
    Used as a hook to delay sending the response of the last packet.
    Throws:
      `IOException`

  - ### delayWriteToDisk

    public void delayWriteToDisk()
    Used as a hook to delay writing a packet to disk.

  - ### delayWriteToOsCache

    public void delayWriteToOsCache()
    Used as a hook to delay writing a packet to os cache.

  - ### logDelaySendingAckToUpstream

    public void logDelaySendingAckToUpstream(String upstreamAddr, long delayMs) throws IOException
    Used as a hook to intercept the latency of sending ack.
    Throws:
      `IOException`

  - ### noRegistration

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

  - ### failMirrorConnection

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

  - ### failPipeline

    public void failPipeline(ReplicaInPipeline replicaInfo, String mirrorAddr) throws IOException
    Throws:
      `IOException`

  - ### startOfferService

    public void startOfferService() throws Exception
    Throws:
      `Exception`

  - ### endOfferService

    public void endOfferService() throws Exception
    Throws:
      `Exception`

  - ### throwTooManyOpenFiles

    public void throwTooManyOpenFiles() throws FileNotFoundException
    Throws:
      `FileNotFoundException`

  - ### stripedBlockReconstruction

    public void stripedBlockReconstruction() throws IOException
    Used as a hook to inject failure in erasure coding reconstruction process.
    Throws:
      `IOException`

  - ### stripedBlockChecksumReconstruction

    public void stripedBlockChecksumReconstruction() throws IOException
    Used as a hook to inject failure in erasure coding checksum reconstruction process.
    Throws:
      `IOException`

  - ### delayBlockReader

    public void delayBlockReader()
    Used as a hook to inject latency when read block in erasure coding reconstruction process.

  - ### interceptFreeBlockReaderBuffer

    public void interceptFreeBlockReaderBuffer()
    Used as a hook to inject intercept when free the block reader buffer.

  - ### interceptBlockReader

    public void interceptBlockReader()
    Used as a hook to inject intercept When finish reading from block.

  - ### delayWhenOfferServiceHoldLock

    public void delayWhenOfferServiceHoldLock()
    Used as a hook to inject intercept when BPOfferService hold lock.

  - ### blockUtilSendFullBlockReport

    public void blockUtilSendFullBlockReport()
    Used as a hook to inject intercept when re-register.

  - ### delay

    public void delay()
    Just delay a while.

  - ### badDecoding

    public void badDecoding(ByteBuffer[] outputs)
    Used as a hook to inject data pollution into an erasure coding reconstruction.

  - ### markSlow

    public void markSlow(String dnAddr, int[] replies)

  - ### delayDeleteReplica

    public void delayDeleteReplica()
    Just delay delete replica a while.

  - ### delayDiffRecord

    public void delayDiffRecord()
    Just delay run diff record a while.

  - ### delayGetMetaDataInputStream

    public void delayGetMetaDataInputStream()
    Just delay getMetaDataInputStream a while.

  - ### waitUntilStorageRemoved

    public void waitUntilStorageRemoved()
    Used in `DirectoryScanner.reconcile()` to wait until a storage is removed, leaving a stale copy of `DirectoryScanner.diffs`.