NamenodeProtocolTranslatorPB (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.protocolPB, class: NamenodeProtocolTranslatorPB

Package org.apache.hadoop.hdfs.protocolPB

# Class NamenodeProtocolTranslatorPB

java.lang.Object
org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolTranslatorPB

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `NamenodeProtocol`, `org.apache.hadoop.ipc.ProtocolMetaInterface`, `org.apache.hadoop.ipc.ProtocolTranslator`

@Private @Stable public class NamenodeProtocolTranslatorPB extends Object implements NamenodeProtocol, org.apache.hadoop.ipc.ProtocolMetaInterface, Closeable, org.apache.hadoop.ipc.ProtocolTranslator
This class is the client side translator to translate the requests made on `NamenodeProtocol` interfaces to the RPC server implementing `NamenodeProtocolPB`.

- ## Field Summary

  ### Fields inherited from interface org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol

  `ACT_CHECKPOINT, ACT_SHUTDOWN, ACT_UNKNOWN, FATAL, NOTIFY, versionID`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NamenodeProtocolTranslatorPB(NamenodeProtocolPB rpcProxy)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `void`
  `endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig)`
  A request to the active name-node to finalize previously started checkpoint.
  `void`
  `errorReport(NamenodeRegistration registration, int errorCode, String msg)`
  Report to the active name-node an error occurred on a subordinate node.
  `ExportedBlockKeys`
  `getBlockKeys()`
  Get the current block keys
  `BlocksWithLocations`
  `getBlocks(org.apache.hadoop.hdfs.protocol.DatanodeInfo datanode, long size, long minBlockSize, long timeInterval, org.apache.hadoop.fs.StorageType storageType)`
  Get a list of blocks belonging to `datanode` whose total size equals `size`.
  `RemoteEditLogManifest`
  `getEditLogManifest(long sinceTxId)`
  Return a structure containing details about all edit logs available to be fetched from the NameNode.
  `long`
  `getMostRecentCheckpointTxId()`
  Get the transaction ID of the most recent checkpoint.
  `long`
  `getMostRecentNameNodeFileTxId(NNStorage.NameNodeFile nnf)`
  Get the transaction ID of the most recent checkpoint for the given NameNodeFile.
  `Long`
  `getNextSPSPath()`
  `long`
  `getTransactionID()`
  `Object`
  `getUnderlyingProxyObject()`
  `boolean`
  `isMethodSupported(String methodName)`
  `boolean`
  `isRollingUpgrade()`
  return whether the Namenode is rolling upgrade in progress (true) or not (false).
  `boolean`
  `isUpgradeFinalized()`
  `NamenodeRegistration`
  `registerSubordinateNamenode(NamenodeRegistration registration)`
  Register a subordinate name-node like backup node.
  `CheckpointSignature`
  `rollEditLog()`
  Closes the current edit log and opens a new one.
  `NamenodeCommand`
  `startCheckpoint(NamenodeRegistration registration)`
  A request to the active name-node to start a checkpoint.
  `NamespaceInfo`
  `versionRequest()`
  Request name-node version and storage information.

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

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

- ## Constructor Details

  - ### NamenodeProtocolTranslatorPB

    public NamenodeProtocolTranslatorPB(NamenodeProtocolPB rpcProxy)

- ## Method Details

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`

  - ### getUnderlyingProxyObject

    public Object getUnderlyingProxyObject()
    Specified by:
      `getUnderlyingProxyObject` in interface `org.apache.hadoop.ipc.ProtocolTranslator`

  - ### getBlocks

    public BlocksWithLocations getBlocks(org.apache.hadoop.hdfs.protocol.DatanodeInfo datanode, long size, long minBlockSize, long timeInterval, org.apache.hadoop.fs.StorageType storageType) throws IOException
    Description copied from interface: `NamenodeProtocol`
    Get a list of blocks belonging to `datanode` whose total size equals `size`.
    Specified by:
      `getBlocks` in interface `NamenodeProtocol`
    Parameters:
      `datanode` - a data node
      `size` - requested size
      `minBlockSize` - each block should be of this minimum Block Size
      `timeInterval` - prefer to get blocks which are belong to the cold files accessed before the time interval
      `storageType` - the given storage type `StorageType`
    Returns:
      BlocksWithLocations a list of blocks & their locations
    Throws:
      `IOException` - if size is less than or equal to 0 or datanode does not exist
    See Also:
      - `Balancer`

  - ### getBlockKeys

    public ExportedBlockKeys getBlockKeys() throws IOException
    Description copied from interface: `NamenodeProtocol`
    Get the current block keys
    Specified by:
      `getBlockKeys` in interface `NamenodeProtocol`
    Returns:
      ExportedBlockKeys containing current block keys
    Throws:
      `IOException`

  - ### getTransactionID

    public long getTransactionID() throws IOException
    Specified by:
      `getTransactionID` in interface `NamenodeProtocol`
    Returns:
      The most recent transaction ID that has been synced to persistent storage, or applied from persistent storage in the case of a non-active node.
    Throws:
      `IOException`

  - ### getMostRecentCheckpointTxId

    public long getMostRecentCheckpointTxId() throws IOException
    Description copied from interface: `NamenodeProtocol`
    Get the transaction ID of the most recent checkpoint.
    Specified by:
      `getMostRecentCheckpointTxId` in interface `NamenodeProtocol`
    Throws:
      `IOException`

  - ### getMostRecentNameNodeFileTxId

    public long getMostRecentNameNodeFileTxId(NNStorage.NameNodeFile nnf) throws IOException
    Description copied from interface: `NamenodeProtocol`
    Get the transaction ID of the most recent checkpoint for the given NameNodeFile.
    Specified by:
      `getMostRecentNameNodeFileTxId` in interface `NamenodeProtocol`
    Throws:
      `IOException`

  - ### rollEditLog

    public CheckpointSignature rollEditLog() throws IOException
    Description copied from interface: `NamenodeProtocol`
    Closes the current edit log and opens a new one. The call fails if the file system is in SafeMode.
    Specified by:
      `rollEditLog` in interface `NamenodeProtocol`
    Returns:
      a unique token to identify this transaction.
    Throws:
      `IOException`

  - ### versionRequest

    public NamespaceInfo versionRequest() throws IOException
    Description copied from interface: `NamenodeProtocol`
    Request name-node version and storage information.
    Specified by:
      `versionRequest` in interface `NamenodeProtocol`
    Returns:
      `NamespaceInfo` identifying versions and storage information of the name-node
    Throws:
      `IOException`

  - ### errorReport

    public void errorReport(NamenodeRegistration registration, int errorCode, String msg) throws IOException
    Description copied from interface: `NamenodeProtocol`
    Report to the active name-node an error occurred on a subordinate node. Depending on the error code the active node may decide to unregister the reporting node.
    Specified by:
      `errorReport` in interface `NamenodeProtocol`
    Parameters:
      `registration` - requesting node.
      `errorCode` - indicates the error
      `msg` - free text description of the error
    Throws:
      `IOException`

  - ### registerSubordinateNamenode

    public NamenodeRegistration registerSubordinateNamenode(NamenodeRegistration registration) throws IOException
    Description copied from interface: `NamenodeProtocol`
    Register a subordinate name-node like backup node.
    Specified by:
      `registerSubordinateNamenode` in interface `NamenodeProtocol`
    Returns:
      `NamenodeRegistration` of the node, which this node has just registered with.
    Throws:
      `IOException`

  - ### startCheckpoint

    public NamenodeCommand startCheckpoint(NamenodeRegistration registration) throws IOException
    Description copied from interface: `NamenodeProtocol`
    A request to the active name-node to start a checkpoint. The name-node should decide whether to admit it or reject. The name-node also decides what should be done with the backup node image before and after the checkpoint.
    Specified by:
      `startCheckpoint` in interface `NamenodeProtocol`
    Parameters:
      `registration` - the requesting node
    Returns:
      `CheckpointCommand` if checkpoint is allowed.
    Throws:
      `IOException`
    See Also:
      - `CheckpointCommand`
      - `NamenodeCommand`
      - `NamenodeProtocol.ACT_SHUTDOWN`

  - ### endCheckpoint

    public void endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig) throws IOException
    Description copied from interface: `NamenodeProtocol`
    A request to the active name-node to finalize previously started checkpoint.
    Specified by:
      `endCheckpoint` in interface `NamenodeProtocol`
    Parameters:
      `registration` - the requesting node
      `sig` - `CheckpointSignature` which identifies the checkpoint.
    Throws:
      `IOException`

  - ### getEditLogManifest

    public RemoteEditLogManifest getEditLogManifest(long sinceTxId) throws IOException
    Description copied from interface: `NamenodeProtocol`
    Return a structure containing details about all edit logs available to be fetched from the NameNode.
    Specified by:
      `getEditLogManifest` in interface `NamenodeProtocol`
    Parameters:
      `sinceTxId` - return only logs that contain transactions >= sinceTxId
    Throws:
      `IOException`

  - ### isMethodSupported

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

  - ### isUpgradeFinalized

    public boolean isUpgradeFinalized() throws IOException
    Specified by:
      `isUpgradeFinalized` in interface `NamenodeProtocol`
    Returns:
      Whether the NameNode is in upgrade state (false) or not (true)
    Throws:
      `IOException`

  - ### isRollingUpgrade

    public boolean isRollingUpgrade() throws IOException
    Description copied from interface: `NamenodeProtocol`
    return whether the Namenode is rolling upgrade in progress (true) or not (false).
    Specified by:
      `isRollingUpgrade` in interface `NamenodeProtocol`
    Returns:
    Throws:
      `IOException`

  - ### getNextSPSPath

    public Long getNextSPSPath() throws IOException
    Specified by:
      `getNextSPSPath` in interface `NamenodeProtocol`
    Returns:
      Gets the next available sps path, otherwise null. This API used by External SPS.
    Throws:
      `IOException`