avijayanhwx commented on code in PR #3411:
URL: https://github.com/apache/ozone/pull/3411#discussion_r875026118
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java:
##########
@@ -418,4 +418,37 @@ public static OMRequest
disallowCreateBucketWithBucketLayoutDuringPreFinalize(
}
return req;
}
+
+ /**
+ * Validates bucket create requests.
+ * Handles the cases where an older client attempts to create a bucket
+ * (without passing any bucket layout) and the cluster's protobuf definition
+ * defaults the missing value to a non LEGACY layout.
+ * We do not want to allow this to happen, since this would cause the client
+ * to be able to create 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.CreateBucket
+ )
+ public static OMRequest blockCreateBucketWithBucketLayoutFromOldClient(
+ OMRequest req, ValidationContext ctx) throws OMException {
+ if (req.getCreateBucketRequest().getBucketInfo().hasBucketLayout()
+ &&
+ !BucketLayout.fromProto(req.getCreateBucketRequest().getBucketInfo()
Review Comment:
How can an older client request a bucket of FSO type? Won't that be absent
in the client library?
--
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]