You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ChenSammi (via GitHub)" <gi...@apache.org> on 2023/09/07 08:33:22 UTC

[GitHub] [ozone] ChenSammi commented on a diff in pull request #2424: HDDS-5455. Check invalid keyName when creating new key

ChenSammi commented on code in PR #2424:
URL: https://github.com/apache/ozone/pull/2424#discussion_r1318273968


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerRequestHandler.java:
##########
@@ -307,9 +309,27 @@ public OMClientResponse handleWriteRequest(OMRequest omRequest,
     OMClientResponse omClientResponse = null;
     omClientRequest =
         OzoneManagerRatisUtils.createClientRequest(omRequest, impl);
-    omClientResponse = omClientRequest
-        .validateAndUpdateCache(getOzoneManager(), transactionLogIndex,
-            ozoneManagerDoubleBuffer::add);
+    try {
+      omClientResponse = omClientRequest
+          .validateAndUpdateCache(getOzoneManager(), transactionLogIndex,
+              ozoneManagerDoubleBuffer::add);
+    } catch (InvalidPathException e) {
+      OMException omException = new OMException(e.getMessage(),
+          OMException.ResultCodes.INVALID_PATH);
+      OMResponse.Builder omResponse =
+          OmResponseUtil.getOMResponseBuilder(omRequest);
+      omResponse.setSuccess(false);
+      omResponse.setMessage(omException.getMessage());
+      omResponse.setStatus(OzoneManagerRatisUtils.exceptionToResponseStatus(
+          omException));
+      omClientResponse =
+          new InvalidPathClientResponse(omResponse.build());
+      if (omClientResponse.getFlushFuture() == null) {
+        omClientResponse.setFlushFuture(
+            ozoneManagerDoubleBuffer.add(omClientResponse,
+                transactionLogIndex));

Review Comment:
   @symious , thanks for continue working on this patch.  Can you explain it a bit more about why we need to add this omClientResponse.getFlushFuture() check?



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org