Class DatanodeProtocolClientSideTranslatorPB

java.lang.Object
org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB
All Implemented Interfaces:
Closeable, AutoCloseable, DatanodeProtocol, org.apache.hadoop.ipc.ProtocolMetaInterface

@Private @Stable public class DatanodeProtocolClientSideTranslatorPB extends Object implements org.apache.hadoop.ipc.ProtocolMetaInterface, DatanodeProtocol, Closeable
This class is the client side translator to translate the requests made on DatanodeProtocol interfaces to the RPC server implementing DatanodeProtocolPB.
  • Constructor Details

    • DatanodeProtocolClientSideTranslatorPB

      @VisibleForTesting public DatanodeProtocolClientSideTranslatorPB(DatanodeProtocolPB rpcProxy)
    • DatanodeProtocolClientSideTranslatorPB

      public DatanodeProtocolClientSideTranslatorPB(InetSocketAddress nameNodeAddr, org.apache.hadoop.conf.Configuration conf) throws IOException
      Throws:
      IOException
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • registerDatanode

      public DatanodeRegistration registerDatanode(DatanodeRegistration registration) throws IOException
      Description copied from interface: DatanodeProtocol
      Register Datanode.
      Specified by:
      registerDatanode in interface DatanodeProtocol
      Parameters:
      registration - datanode registration information
      Returns:
      the given DatanodeRegistration with updated registration information
      Throws:
      IOException
      See Also:
      • FSNamesystem.registerDatanode(DatanodeRegistration)
    • sendHeartbeat

      public HeartbeatResponse sendHeartbeat(DatanodeRegistration registration, org.apache.hadoop.hdfs.server.protocol.StorageReport[] reports, long cacheCapacity, long cacheUsed, int xmitsInProgress, int xceiverCount, int failedVolumes, VolumeFailureSummary volumeFailureSummary, boolean requestFullBlockReportLease, @Nonnull org.apache.hadoop.hdfs.server.protocol.SlowPeerReports slowPeers, @Nonnull org.apache.hadoop.hdfs.server.protocol.SlowDiskReports slowDisks) throws IOException
      Description copied from interface: DatanodeProtocol
      sendHeartbeat() tells the NameNode that the DataNode is still alive and well. Includes some status info, too. It also gives the NameNode a chance to return an array of "DatanodeCommand" objects in HeartbeatResponse. A DatanodeCommand tells the DataNode to invalidate local block(s), or to copy them to other DataNodes, etc.
      Specified by:
      sendHeartbeat in interface DatanodeProtocol
      Parameters:
      registration - datanode registration information.
      reports - utilization report per storage.
      cacheCapacity - the total cache capacity of the datanode (in bytes).
      cacheUsed - the amount of cache used by the datanode (in bytes).
      xmitsInProgress - number of transfers from this datanode to others.
      xceiverCount - number of active transceiver threads.
      failedVolumes - number of failed volumes.
      volumeFailureSummary - info about volume failures.
      requestFullBlockReportLease - whether to request a full block report lease.
      slowPeers - Details of peer DataNodes that were detected as being slow to respond to packet writes. Empty report if no slow peers were detected by the DataNode.
      slowDisks - Details of disks on DataNodes that were detected as being slow. Empty report if no slow disks were detected.
      Throws:
      IOException - on error.
    • blockReport

      public DatanodeCommand blockReport(DatanodeRegistration registration, String poolId, StorageBlockReport[] reports, BlockReportContext context) throws IOException
      Description copied from interface: DatanodeProtocol
      blockReport() tells the NameNode about all the locally-stored blocks. The NameNode returns an array of Blocks that have become obsolete and should be deleted. This function is meant to upload *all* the locally-stored blocks. It's invoked upon startup and then infrequently afterwards.
      Specified by:
      blockReport in interface DatanodeProtocol
      Parameters:
      registration - datanode registration
      poolId - the block pool ID for the blocks
      reports - report of blocks per storage Each finalized block is represented as 3 longs. Each under- construction replica is represented as 4 longs. This is done instead of Block[] to reduce memory used by block reports.
      context - Context information for this block report.
      Returns:
      - the next command for DN to process.
      Throws:
      IOException
    • cacheReport

      public DatanodeCommand cacheReport(DatanodeRegistration registration, String poolId, List<Long> blockIds) throws IOException
      Description copied from interface: DatanodeProtocol
      Communicates the complete list of locally cached blocks to the NameNode. This method is similar to DatanodeProtocol.blockReport(DatanodeRegistration, String, StorageBlockReport[], BlockReportContext), which is used to communicated blocks stored on disk.
      Specified by:
      cacheReport in interface DatanodeProtocol
      Parameters:
      registration - The datanode registration.
      poolId - The block pool ID for the blocks.
      blockIds - A list of block IDs.
      Returns:
      The DatanodeCommand.
      Throws:
      IOException
    • blockReceivedAndDeleted

      public void blockReceivedAndDeleted(DatanodeRegistration registration, String poolId, StorageReceivedDeletedBlocks[] receivedAndDeletedBlocks) throws IOException
      Description copied from interface: DatanodeProtocol
      blockReceivedAndDeleted() allows the DataNode to tell the NameNode about recently-received and -deleted block data. For the case of received blocks, a hint for preferred replica to be deleted when there is any excessive blocks is provided. For example, whenever client code writes a new Block here, or another DataNode copies a Block to this DataNode, it will call blockReceived().
      Specified by:
      blockReceivedAndDeleted in interface DatanodeProtocol
      Throws:
      IOException
    • errorReport

      public void errorReport(DatanodeRegistration registration, int errorCode, String msg) throws IOException
      Description copied from interface: DatanodeProtocol
      errorReport() tells the NameNode about something that has gone awry. Useful for debugging.
      Specified by:
      errorReport in interface DatanodeProtocol
      Throws:
      IOException
    • versionRequest

      public NamespaceInfo versionRequest() throws IOException
      Specified by:
      versionRequest in interface DatanodeProtocol
      Throws:
      IOException
    • reportBadBlocks

      public void reportBadBlocks(org.apache.hadoop.hdfs.protocol.LocatedBlock[] blocks) throws IOException
      Description copied from interface: DatanodeProtocol
      same as ClientProtocol.reportBadBlocks(LocatedBlock[]) }
      Specified by:
      reportBadBlocks in interface DatanodeProtocol
      Throws:
      IOException
    • commitBlockSynchronization

      public void commitBlockSynchronization(org.apache.hadoop.hdfs.protocol.ExtendedBlock block, long newgenerationstamp, long newlength, boolean closeFile, boolean deleteblock, org.apache.hadoop.hdfs.protocol.DatanodeID[] newtargets, String[] newtargetstorages) throws IOException
      Description copied from interface: DatanodeProtocol
      Commit block synchronization in lease recovery
      Specified by:
      commitBlockSynchronization in interface DatanodeProtocol
      Throws:
      IOException
    • isMethodSupported

      public boolean isMethodSupported(String methodName) throws IOException
      Specified by:
      isMethodSupported in interface org.apache.hadoop.ipc.ProtocolMetaInterface
      Throws:
      IOException