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.-
Field Summary
Fields inherited from interface org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol
DISK_ERROR, DNA_ACCESSKEYUPDATE, DNA_BALANCERBANDWIDTHUPDATE, DNA_BLOCK_STORAGE_MOVEMENT, DNA_CACHE, DNA_DROP_SPS_WORK_COMMAND, DNA_ERASURE_CODING_RECONSTRUCTION, DNA_FINALIZE, DNA_INVALIDATE, DNA_RECOVERBLOCK, DNA_REGISTER, DNA_SHUTDOWN, DNA_TRANSFER, DNA_UNCACHE, DNA_UNKNOWN, FATAL_DISK_ERROR, INVALID_BLOCK, NOTIFY, versionID -
Constructor Summary
ConstructorsConstructorDescriptionDatanodeProtocolClientSideTranslatorPB(InetSocketAddress nameNodeAddr, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidblockReceivedAndDeleted(DatanodeRegistration registration, String poolId, StorageReceivedDeletedBlocks[] receivedAndDeletedBlocks) blockReceivedAndDeleted() allows the DataNode to tell the NameNode about recently-received and -deleted block data.blockReport(DatanodeRegistration registration, String poolId, StorageBlockReport[] reports, BlockReportContext context) blockReport() tells the NameNode about all the locally-stored blocks.cacheReport(DatanodeRegistration registration, String poolId, List<Long> blockIds) Communicates the complete list of locally cached blocks to the NameNode.voidclose()voidcommitBlockSynchronization(org.apache.hadoop.hdfs.protocol.ExtendedBlock block, long newgenerationstamp, long newlength, boolean closeFile, boolean deleteblock, org.apache.hadoop.hdfs.protocol.DatanodeID[] newtargets, String[] newtargetstorages) Commit block synchronization in lease recoveryvoiderrorReport(DatanodeRegistration registration, int errorCode, String msg) errorReport() tells the NameNode about something that has gone awry.booleanisMethodSupported(String methodName) registerDatanode(DatanodeRegistration registration) Register Datanode.voidreportBadBlocks(org.apache.hadoop.hdfs.protocol.LocatedBlock[] blocks) same asClientProtocol.reportBadBlocks(LocatedBlock[])}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, org.apache.hadoop.hdfs.server.protocol.SlowPeerReports slowPeers, org.apache.hadoop.hdfs.server.protocol.SlowDiskReports slowDisks) sendHeartbeat() tells the NameNode that the DataNode is still alive and well.
-
Constructor Details
-
DatanodeProtocolClientSideTranslatorPB
-
DatanodeProtocolClientSideTranslatorPB
public DatanodeProtocolClientSideTranslatorPB(InetSocketAddress nameNodeAddr, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
registerDatanode
Description copied from interface:DatanodeProtocolRegister Datanode.- Specified by:
registerDatanodein interfaceDatanodeProtocol- Parameters:
registration- datanode registration information- Returns:
- the given
DatanodeRegistrationwith 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:DatanodeProtocolsendHeartbeat() 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:
sendHeartbeatin interfaceDatanodeProtocol- 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:DatanodeProtocolblockReport() 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:
blockReportin interfaceDatanodeProtocol- Parameters:
registration- datanode registrationpoolId- the block pool ID for the blocksreports- 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:DatanodeProtocolCommunicates the complete list of locally cached blocks to the NameNode. This method is similar toDatanodeProtocol.blockReport(DatanodeRegistration, String, StorageBlockReport[], BlockReportContext), which is used to communicated blocks stored on disk.- Specified by:
cacheReportin interfaceDatanodeProtocol- 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:DatanodeProtocolblockReceivedAndDeleted() 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:
blockReceivedAndDeletedin interfaceDatanodeProtocol- Throws:
IOException
-
errorReport
public void errorReport(DatanodeRegistration registration, int errorCode, String msg) throws IOException Description copied from interface:DatanodeProtocolerrorReport() tells the NameNode about something that has gone awry. Useful for debugging.- Specified by:
errorReportin interfaceDatanodeProtocol- Throws:
IOException
-
versionRequest
- Specified by:
versionRequestin interfaceDatanodeProtocol- Throws:
IOException
-
reportBadBlocks
public void reportBadBlocks(org.apache.hadoop.hdfs.protocol.LocatedBlock[] blocks) throws IOException Description copied from interface:DatanodeProtocolsame asClientProtocol.reportBadBlocks(LocatedBlock[])}- Specified by:
reportBadBlocksin interfaceDatanodeProtocol- 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:DatanodeProtocolCommit block synchronization in lease recovery- Specified by:
commitBlockSynchronizationin interfaceDatanodeProtocol- Throws:
IOException
-
isMethodSupported
- Specified by:
isMethodSupportedin interfaceorg.apache.hadoop.ipc.ProtocolMetaInterface- Throws:
IOException
-