[
https://issues.apache.org/jira/browse/HDDS-1551?focusedWorklogId=250630&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-250630
]
ASF GitHub Bot logged work on HDDS-1551:
----------------------------------------
Author: ASF GitHub Bot
Created on: 30/May/19 00:01
Start Date: 30/May/19 00:01
Worklog Time Spent: 10m
Work Description: bharatviswa504 commented on pull request #850:
HDDS-1551. Implement Bucket Write Requests to use Cache and DoubleBuf…
URL: https://github.com/apache/hadoop/pull/850#discussion_r288813544
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
##########
@@ -97,6 +112,101 @@ private static long nextCallId() {
return CALL_ID_COUNTER.getAndIncrement() & Long.MAX_VALUE;
}
+ /**
+ * Submit request to Ratis server.
+ * @param omRequest
+ * @return OMResponse - response returned to the client.
+ * @throws ServiceException
+ */
+ public OMResponse submitRequest(OMRequest omRequest) throws ServiceException
{
+ RaftClientRequest raftClientRequest =
+ createWriteRaftClientRequest(omRequest);
+ RaftClientReply raftClientReply;
+ try {
+ raftClientReply = server.submitClientRequestAsync(raftClientRequest)
+ .get();
+ } catch (Exception ex) {
+ throw new ServiceException(ex.getMessage(), ex);
+ }
+
+ return processReply(omRequest, raftClientReply);
+ }
+
+ /**
+ * Create Write RaftClient request from OMRequest.
+ * @param omRequest
+ * @return
+ */
+ private RaftClientRequest createWriteRaftClientRequest(OMRequest omRequest) {
+ return new RaftClientRequest(clientId, server.getId(), raftGroupId,
+ nextCallId(),
+ Message.valueOf(OMRatisHelper.convertRequestToByteString(omRequest)),
+ RaftClientRequest.writeRequestType(), null);
+ }
+
+ /**
+ * Process the raftClientReply and return OMResponse.
+ * @param omRequest
+ * @param reply
+ * @return
+ * @throws ServiceException
+ */
+ private OMResponse processReply(OMRequest omRequest, RaftClientReply reply)
+ throws ServiceException {
+ // NotLeader exception is thrown only when the raft server to which the
+ // request is submitted is not the leader. This can happen first time
+ // when client is submitting request to OM.
+ NotLeaderException notLeaderException = reply.getNotLeaderException();
+ if (notLeaderException != null) {
+ throw new ServiceException(notLeaderException);
+ }
+ StateMachineException stateMachineException =
+ reply.getStateMachineException();
+ if (stateMachineException != null) {
+ OMResponse.Builder omResponse = OMResponse.newBuilder();
+ omResponse.setCmdType(omRequest.getCmdType());
+ omResponse.setSuccess(false);
+ omResponse.setMessage(stateMachineException.getCause().getMessage());
+ omResponse.setStatus(parseErrorStatus(
+ stateMachineException.getCause().getMessage()));
+ return omResponse.build();
+ }
+
+ try {
+ return OMRatisHelper.getOMResponseFromRaftClientReply(reply);
+ } catch (InvalidProtocolBufferException ex) {
+ if (ex.getMessage() != null) {
+ throw new ServiceException(ex.getMessage(), ex);
+ } else {
+ throw new ServiceException(ex);
+ }
+ }
+
+ // TODO: Still need to handle RaftRetry failure exception and
+ // NotReplicated exception.
Review comment:
Currently using ratisClient there is a TODO for RaftRetry failure exception,
and I don't see anything is done for handling NotReplicatedException.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 250630)
Time Spent: 6h (was: 5h 50m)
> Implement Bucket Write Requests to use Cache and DoubleBuffer
> -------------------------------------------------------------
>
> Key: HDDS-1551
> URL: https://issues.apache.org/jira/browse/HDDS-1551
> Project: Hadoop Distributed Data Store
> Issue Type: Sub-task
> Components: Ozone Manager
> Reporter: Bharat Viswanadham
> Assignee: Bharat Viswanadham
> Priority: Major
> Labels: pull-request-available
> Time Spent: 6h
> Remaining Estimate: 0h
>
> Implement Bucket write requests to use OM Cache, double buffer.
> And also in OM previously we used to Ratis client for communication to Ratis
> server, instead of that use Ratis server API's.
>
> In this Jira will add the changes to implement bucket operations, and
> HA/Non-HA will have a different code path, but once all requests are
> implemented will have a single code path.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]