Class RouterStateIdContext

java.lang.Object
org.apache.hadoop.hdfs.server.federation.router.RouterStateIdContext
All Implemented Interfaces:
org.apache.hadoop.ipc.AlignmentContext

@Private @Evolving public class RouterStateIdContext extends Object implements org.apache.hadoop.ipc.AlignmentContext
This is the router implementation to hold the state Ids for all namespaces. This object is only updated by responses from NameNodes.
  • Method Details

    • setResponseHeaderState

      public void setResponseHeaderState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder headerBuilder)
      Adds the namespaceIdMap to the response header that will be sent to a client.
      Parameters:
      headerBuilder - the response header that will be sent to a client.
    • getNamespaceStateId

      public LongAccumulator getNamespaceStateId(String nsId)
    • getNamespaces

      public List<String> getNamespaces()
    • getNamespaceIdMap

      public ConcurrentHashMap<String,LongAccumulator> getNamespaceIdMap()
    • removeNamespaceStateId

      public void removeNamespaceStateId(String nsId)
    • getRouterFederatedStateMap

      public static Map<String,Long> getRouterFederatedStateMap(org.apache.hadoop.thirdparty.protobuf.ByteString byteString)
      Utility function to parse routerFederatedState field in RPC headers.
      Parameters:
      byteString - the byte string of routerFederatedState.
      Returns:
      the router federated state map.
    • getClientStateIdFromCurrentCall

      public static long getClientStateIdFromCurrentCall(String nsId)
    • updateResponseState

      public void updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
      Specified by:
      updateResponseState in interface org.apache.hadoop.ipc.AlignmentContext
    • receiveResponseState

      public void receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header)
      Specified by:
      receiveResponseState in interface org.apache.hadoop.ipc.AlignmentContext
    • updateRequestState

      public void updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header)
      Specified by:
      updateRequestState in interface org.apache.hadoop.ipc.AlignmentContext
    • receiveRequestState

      public long receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long clientWaitTime) throws org.apache.hadoop.ipc.RetriableException
      Routers do not update their state using information from clients to avoid clients interfering with one another.
      Specified by:
      receiveRequestState in interface org.apache.hadoop.ipc.AlignmentContext
      Throws:
      org.apache.hadoop.ipc.RetriableException
    • getLastSeenStateId

      public long getLastSeenStateId()
      Specified by:
      getLastSeenStateId in interface org.apache.hadoop.ipc.AlignmentContext
    • isCoordinatedCall

      public boolean isCoordinatedCall(String protocolName, String methodName)
      Specified by:
      isCoordinatedCall in interface org.apache.hadoop.ipc.AlignmentContext