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 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.