Package org.apache.hadoop.ozone.om.ratis
Class OzoneManagerRatisServer
java.lang.Object
org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServer
Creates a Ratis server endpoint for OM.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines RaftServer Status. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOMToRatisRing(org.apache.hadoop.ozone.om.helpers.OMNodeDetails newOMNode) Add new OM to the Ratis ring.voidaddRaftPeer(org.apache.hadoop.ozone.om.helpers.OMNodeDetails omNodeDetails) Add given node to list of RaftPeers.org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponsebooleandoesPeerExist(String peerId) Check if the input peerId exists in the peers list.org.apache.ratis.server.protocol.TermIndexorg.apache.ratis.protocol.RaftPeerIdCheck Leader status and return the state of the RaftServer.Return a list of peer NodeIds.getPeerIds(org.apache.ratis.proto.RaftProtos.RaftPeerRole role) List<org.apache.ratis.protocol.RaftPeer> getPeers()List<org.apache.ratis.protocol.RaftPeer> getPeers(org.apache.ratis.proto.RaftProtos.RaftPeerRole role) List<org.apache.ratis.protocol.RaftPeer> Get peers by role, excluding a specific node ID.org.apache.ratis.protocol.RaftGrouporg.apache.ratis.protocol.RaftGroupIdstatic UUIDgetRaftGroupIdFromOmServiceId(String omServiceId) getRaftLeaderAddress(org.apache.ratis.protocol.RaftPeer leaderPeer) org.apache.ratis.protocol.RaftPeerIdorg.apache.ratis.server.RaftServer.Divisionintorg.apache.ratis.util.LifeCycle.Stateorg.apache.hadoop.ozone.om.exceptions.OMNotLeaderExceptionstatic OzoneManagerRatisServernewOMRatisServer(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) Creates an instance of OzoneManagerRatisServer.static org.apache.ratis.conf.RaftPropertiesnewRaftProperties(org.apache.hadoop.hdds.conf.ConfigurationSource conf, int port, String ratisStorageDir) voidremoveOMFromRatisRing(org.apache.hadoop.ozone.om.helpers.OMNodeDetails removeOMNode) Remove decommissioned OM node from Ratis ring.voidremoveRaftPeer(org.apache.hadoop.ozone.om.helpers.OMNodeDetails omNodeDetails) Remove given node from list of RaftPeers.voidstart()Start the Ratis server.voidstop()org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponsesubmitRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest) Submit request to Ratis server.org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponsesubmitRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, org.apache.ratis.protocol.ClientId cliId, long callId) API used internally from OzoneManager Server when requests need to be submitted.
-
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 IOExceptionCreates 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
Return a list of peer NodeIds. -
getPeerIds
-
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 byexcludeNodeId- the node ID to exclude- Returns:
- list of peers with the specified role, excluding the specified node
-
doesPeerExist
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
-
getOzoneManager
-
start
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
Check Leader status and return the state of the RaftServer.- Returns:
- RaftServerStatus.
-
getCurrentListenersFromRaftConf
- Throws:
IOException
-
getServerPort
public int getServerPort() -
getServerState
public org.apache.ratis.util.LifeCycle.State getServerState() -
getRaftPeerId
public org.apache.ratis.protocol.RaftPeerId getRaftPeerId() -
getRaftLeaderAddress
-
getRaftGroupIdFromOmServiceId
-
getRatisStorageDir
-
getLastAppliedTermIndex
public org.apache.ratis.server.protocol.TermIndex getLastAppliedTermIndex() -
getRaftGroupId
public org.apache.ratis.protocol.RaftGroupId getRaftGroupId()
-