errose28 commented on a change in pull request #1705:
URL: https://github.com/apache/ozone/pull/1705#discussion_r547527463



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
##########
@@ -128,10 +129,25 @@ private static long nextCallId() {
    * @throws ServiceException
    */
   public OMResponse submitRequest(OMRequest omRequest) throws ServiceException 
{
-    RaftClientRequest raftClientRequest =
-        createWriteRaftClientRequest(omRequest);
-    RaftClientReply raftClientReply = submitRequestToRatis(raftClientRequest);
-    return processReply(omRequest, raftClientReply);
+    // In prepare mode, only prepare and cancel requests are allowed to go
+    // through.
+    if (OzoneManagerPrepareState.requestAllowed(omRequest.getCmdType())) {
+      RaftClientRequest raftClientRequest =
+          createWriteRaftClientRequest(omRequest);
+      RaftClientReply raftClientReply = 
submitRequestToRatis(raftClientRequest);
+
+      return processReply(omRequest, raftClientReply);
+    } else {
+      String message = "Cannot apply write request " +
+          omRequest.getCmdType().name() + " when OM is in prepare mode.";
+      OMResponse.Builder omResponse = OMResponse.newBuilder()
+          .setMessage(message)
+          .setStatus(OzoneManagerProtocolProtos.Status.NOT_SUPPORTED_OPERATION)

Review comment:
       Yes, I have created a new dedicated status for rejecting requests 
because the om is in prepare mode. Thanks for the suggestion!




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to