JyotinderSingh commented on code in PR #3411:
URL: https://github.com/apache/ozone/pull/3411#discussion_r877740729
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -192,4 +198,38 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
}
}
+ /**
+ * Validates bucket delete requests.
+ * Handles the cases where an older client attempts to delete a bucket
+ * a new bucket layout.
+ * We do not want to allow this to happen, since this would cause the client
+ * to be able to delete buckets it cannot understand.
+ *
+ * @param req - the request to validate
+ * @param ctx - the validation context
+ * @return the validated request
+ * @throws OMException if the request is invalid
+ */
+ @RequestFeatureValidator(
+ conditions = ValidationCondition.OLDER_CLIENT_REQUESTS,
+ processingPhase = RequestProcessingPhase.PRE_PROCESS,
+ requestType = Type.DeleteBucket
+ )
+ public static OMRequest blockBucketDeleteWithBucketLayoutFromOldClient(
+ OMRequest req, ValidationContext ctx) throws IOException {
+ DeleteBucketRequest request = req.getDeleteBucketRequest();
+
+ if (request.hasBucketName() && request.hasVolumeName() &&
+ !ctx.getBucketLayout(
Review Comment:
Thank you for the suggestion, I have update the patch.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -192,4 +198,38 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
}
}
+ /**
+ * Validates bucket delete requests.
+ * Handles the cases where an older client attempts to delete a bucket
+ * a new bucket layout.
+ * We do not want to allow this to happen, since this would cause the client
+ * to be able to delete buckets it cannot understand.
+ *
+ * @param req - the request to validate
+ * @param ctx - the validation context
+ * @return the validated request
+ * @throws OMException if the request is invalid
+ */
+ @RequestFeatureValidator(
+ conditions = ValidationCondition.OLDER_CLIENT_REQUESTS,
+ processingPhase = RequestProcessingPhase.PRE_PROCESS,
+ requestType = Type.DeleteBucket
+ )
+ public static OMRequest blockBucketDeleteWithBucketLayoutFromOldClient(
+ OMRequest req, ValidationContext ctx) throws IOException {
+ DeleteBucketRequest request = req.getDeleteBucketRequest();
+
+ if (request.hasBucketName() && request.hasVolumeName() &&
+ !ctx.getBucketLayout(
Review Comment:
Thank you for the suggestion, I have updated the patch.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]