Class OzoneManagerRatisUtils
java.lang.Object
org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerRatisUtils
Utility class used by OzoneManager HA.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckLeaderStatus(OzoneManager ozoneManager) static OMClientRequestcreateClientRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, OzoneManager ozoneManager) Create OMClientRequest which encapsulates the OMRequest.static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponsecreateErrorResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, IOException exception) static org.apache.ratis.grpc.GrpcTlsConfigcreateServerTlsConfig(org.apache.hadoop.hdds.security.SecurityConfig conf, org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient caClient) static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.StatusexceptionToResponseStatus(Exception exception) Convert exception result toOzoneManagerProtocolProtos.Status.static StringgetOMRatisDirectory(org.apache.hadoop.hdds.conf.ConfigurationSource conf) Get the local directory where ratis logs will be stored.static StringgetOMRatisSnapshotDirectory(org.apache.hadoop.hdds.conf.ConfigurationSource conf) Get the local directory where ratis snapshots will be stored.static org.apache.hadoop.hdds.utils.TransactionInfogetTrxnInfoFromCheckpoint(org.apache.hadoop.hdds.conf.OzoneConfiguration conf, Path dbPath) Obtain OMTransactionInfo from Checkpoint.static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponsesubmitRequest(OzoneManager om, org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, org.apache.ratis.protocol.ClientId clientId, long callId) static booleanverifyTransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo transactionInfo, long lastAppliedIndex, String leaderId, Path newDBlocation) Verify transaction info with provided lastAppliedIndex.
-
Method Details
-
createClientRequest
public static OMClientRequest createClientRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, OzoneManager ozoneManager) throws IOException Create OMClientRequest which encapsulates the OMRequest.- Parameters:
omRequest-- Returns:
- OMClientRequest
- Throws:
IOException
-
exceptionToResponseStatus
public static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status exceptionToResponseStatus(Exception exception) Convert exception result toOzoneManagerProtocolProtos.Status.- Parameters:
exception-- Returns:
- Status
-
getTrxnInfoFromCheckpoint
public static org.apache.hadoop.hdds.utils.TransactionInfo getTrxnInfoFromCheckpoint(org.apache.hadoop.hdds.conf.OzoneConfiguration conf, Path dbPath) throws Exception Obtain OMTransactionInfo from Checkpoint.- Throws:
Exception
-
verifyTransactionInfo
public static boolean verifyTransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo transactionInfo, long lastAppliedIndex, String leaderId, Path newDBlocation) Verify transaction info with provided lastAppliedIndex. If transaction info transaction Index is less than or equal to lastAppliedIndex, return false, else return true.- Parameters:
transactionInfo-lastAppliedIndex-leaderId-newDBlocation-- Returns:
- boolean
-
getOMRatisDirectory
Get the local directory where ratis logs will be stored. -
getOMRatisSnapshotDirectory
public static String getOMRatisSnapshotDirectory(org.apache.hadoop.hdds.conf.ConfigurationSource conf) Get the local directory where ratis snapshots will be stored. -
checkLeaderStatus
public static void checkLeaderStatus(OzoneManager ozoneManager) throws com.google.protobuf.ServiceException - Throws:
com.google.protobuf.ServiceException
-
createServerTlsConfig
public static org.apache.ratis.grpc.GrpcTlsConfig createServerTlsConfig(org.apache.hadoop.hdds.security.SecurityConfig conf, org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient caClient) throws IOException - Throws:
IOException
-
submitRequest
public static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse submitRequest(OzoneManager om, org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, org.apache.ratis.protocol.ClientId clientId, long callId) throws com.google.protobuf.ServiceException - Throws:
com.google.protobuf.ServiceException
-
createErrorResponse
public static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse createErrorResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest omRequest, IOException exception)
-