Class OzoneManagerRatisServer

java.lang.Object
org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServer

public final class OzoneManagerRatisServer extends Object
Creates a Ratis server endpoint for OM.
  • Method Details

    • newOMRatisServer

      public static OzoneManagerRatisServer newOMRatisServer(org.apache.hadoop.hdds.conf.ConfigurationSource ozoneConf, OzoneManager omProtocol, org.apache.hadoop.ozone.om.helpers.OMNodeDetails omNodeDetails, Map<String,org.apache.hadoop.ozone.om.helpers.OMNodeDetails> peerNodes, org.apache.hadoop.hdds.security.SecurityConfig secConfig, org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient certClient, boolean isBootstrapping) throws IOException
      Creates an instance of OzoneManagerRatisServer.
      Throws:
      IOException
    • submitRequest

      public org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse submitRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest) throws com.google.protobuf.ServiceException
      Submit request to Ratis server.
      Parameters:
      omRequest -
      Returns:
      OMResponse - response returned to the client.
      Throws:
      com.google.protobuf.ServiceException
    • submitRequest

      public org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse submitRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, org.apache.ratis.protocol.ClientId cliId, long callId) throws com.google.protobuf.ServiceException
      API used internally from OzoneManager Server when requests need to be submitted.
      Parameters:
      omRequest -
      cliId -
      callId -
      Returns:
      OMResponse
      Throws:
      com.google.protobuf.ServiceException
    • addOMToRatisRing

      public void addOMToRatisRing(org.apache.hadoop.ozone.om.helpers.OMNodeDetails newOMNode) throws IOException
      Add new OM to the Ratis ring.
      Throws:
      IOException
    • removeOMFromRatisRing

      public void removeOMFromRatisRing(org.apache.hadoop.ozone.om.helpers.OMNodeDetails removeOMNode) throws IOException
      Remove decommissioned OM node from Ratis ring.
      Throws:
      IOException
    • getPeerIds

      public Set<String> getPeerIds()
      Return a list of peer NodeIds.
    • getPeerIds

      public Set<String> getPeerIds(org.apache.ratis.proto.RaftProtos.RaftPeerRole role)
    • getPeers

      public List<org.apache.ratis.protocol.RaftPeer> getPeers()
    • getPeers

      public List<org.apache.ratis.protocol.RaftPeer> getPeers(org.apache.ratis.proto.RaftProtos.RaftPeerRole role)
    • getPeers

      public List<org.apache.ratis.protocol.RaftPeer> getPeers(org.apache.ratis.proto.RaftProtos.RaftPeerRole role, String excludeNodeId)
      Get peers by role, excluding a specific node ID.
      Parameters:
      role - the role to filter by
      excludeNodeId - the node ID to exclude
      Returns:
      list of peers with the specified role, excluding the specified node
    • doesPeerExist

      public boolean doesPeerExist(String peerId)
      Check if the input peerId exists in the peers list.
      Returns:
      true if the nodeId is self or it exists in peer node list, false otherwise.
    • addRaftPeer

      public void addRaftPeer(org.apache.hadoop.ozone.om.helpers.OMNodeDetails omNodeDetails)
      Add given node to list of RaftPeers.
    • removeRaftPeer

      public void removeRaftPeer(org.apache.hadoop.ozone.om.helpers.OMNodeDetails omNodeDetails)
      Remove given node from list of RaftPeers.
    • checkRetryCache

      public org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse checkRetryCache() throws com.google.protobuf.ServiceException
      Throws:
      com.google.protobuf.ServiceException
    • getRaftGroup

      public org.apache.ratis.protocol.RaftGroup getRaftGroup()
    • getServerDivision

      public org.apache.ratis.server.RaftServer.Division getServerDivision()
    • getOmStateMachine

      public OzoneManagerStateMachine getOmStateMachine()
    • getOzoneManager

      public OzoneManager getOzoneManager()
    • start

      public void start() throws IOException
      Start the Ratis server.
      Throws:
      IOException
    • stop

      public void stop()
    • newRaftProperties

      public static org.apache.ratis.conf.RaftProperties newRaftProperties(org.apache.hadoop.hdds.conf.ConfigurationSource conf, int port, String ratisStorageDir)
    • getLeaderId

      public org.apache.ratis.protocol.RaftPeerId getLeaderId()
    • newOMNotLeaderException

      public org.apache.hadoop.ozone.om.exceptions.OMNotLeaderException newOMNotLeaderException()
    • getLeaderStatus

      public OzoneManagerRatisServer.RaftServerStatus getLeaderStatus()
      Check Leader status and return the state of the RaftServer.
      Returns:
      RaftServerStatus.
    • getCurrentListenersFromRaftConf

      public List<String> getCurrentListenersFromRaftConf() throws IOException
      Throws:
      IOException
    • getServerPort

      public int getServerPort()
    • getServerState

      public org.apache.ratis.util.LifeCycle.State getServerState()
    • getRaftPeerId

      public org.apache.ratis.protocol.RaftPeerId getRaftPeerId()
    • getRaftLeaderAddress

      public String getRaftLeaderAddress(org.apache.ratis.protocol.RaftPeer leaderPeer)
    • getRaftGroupIdFromOmServiceId

      public static UUID getRaftGroupIdFromOmServiceId(String omServiceId)
    • getRatisStorageDir

      public String getRatisStorageDir()
    • getLastAppliedTermIndex

      public org.apache.ratis.server.protocol.TermIndex getLastAppliedTermIndex()
    • getRaftGroupId

      public org.apache.ratis.protocol.RaftGroupId getRaftGroupId()