You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/08/10 11:23:24 UTC

[GitHub] [ozone] rakeshadr commented on a diff in pull request #3508: HDDS-6682. Validate Bucket ID of bucket associated with in-flight requests.

rakeshadr commented on code in PR #3508:
URL: https://github.com/apache/ozone/pull/3508#discussion_r942333554


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequestUtils.java:
##########
@@ -47,4 +53,50 @@ public static void checkClientRequestPrecondition(
           OMException.ResultCodes.INTERNAL_ERROR);
     }
   }
+
+  /**
+   * Validates the bucket associated with the request - to make sure it did
+   * not change since the request started processing.
+   *
+   * @param bucketId  - bucket ID of the associated bucket when the request
+   *                  is being processed.
+   * @param omRequest - request to be validated, contains the bucket ID of the
+   *                  associated bucket when the request was created.
+   * @throws OMException
+   */
+  public static void validateAssociatedBucketId(long bucketId,
+                                                OMRequest omRequest)
+      throws OMException {
+    if (omRequest.hasAssociatedBucketId()) {
+      if (bucketId != omRequest.getAssociatedBucketId()) {
+        throw new OMException(
+            "Bucket ID mismatch. Associated bucket was modified while this" +

Review Comment:
   Please include request type in the err message and modify the message like below:
   
   `Bucket ID mismatch. Associated bucket was modified concurrently while " + omRequest..getCmdType() + " request was being processed. Please retry the request.`



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