errose28 commented on code in PR #3377:
URL: https://github.com/apache/ozone/pull/3377#discussion_r864358504


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java:
##########
@@ -393,4 +393,52 @@ public static OMRequest 
disallowCreateBucketWithECReplicationConfig(
     }
     return req;
   }
+
+  @RequestFeatureValidator(
+      conditions = ValidationCondition.CLUSTER_NEEDS_FINALIZATION,
+      processingPhase = RequestProcessingPhase.PRE_PROCESS,
+      requestType = Type.CreateBucket
+  )
+  public static OMRequest 
disallowCreateBucketWithBucketLayoutDuringPreFinalize(
+      OMRequest req, ValidationContext ctx) throws OMException {
+    if (!ctx.versionManager()
+        .isAllowed(OMLayoutFeature.BUCKET_LAYOUT_SUPPORT)) {
+      if (req.getCreateBucketRequest()
+          .getBucketInfo().hasBucketLayout()
+          &&
+          !BucketLayout.fromProto(req.getCreateBucketRequest().getBucketInfo()
+              .getBucketLayout()).isLegacy()) {
+        throw new OMException("Cluster does not have the Bucket Layout"
+            + " support feature finalized yet, but the request contains"
+            + " a non LEGACY bucket type. Rejecting the request,"
+            + " please finalize the cluster upgrade and then try again.",
+            
OMException.ResultCodes.NOT_SUPPORTED_OPERATION_PRIOR_FINALIZATION);
+      }
+    }
+    return req;
+  }
+
+  @RequestFeatureValidator(
+      conditions = ValidationCondition.OLDER_CLIENT_REQUESTS,

Review Comment:
   I don't think this is needed. It will probably be easier to handle all 
client cross compatibility in its own PR.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/upgrade/OMLayoutFeature.java:
##########
@@ -32,7 +32,10 @@ public enum OMLayoutFeature implements LayoutFeature {
   INITIAL_VERSION(0, "Initial Layout Version"),
 
   ERASURE_CODED_STORAGE_SUPPORT(1, "Ozone version with built in support for"
-      + " Erasure Coded block data storage.");
+      + " Erasure Coded block data storage."),
+
+  BUCKET_LAYOUT_SUPPORT(2, "Ozone version with built in support for"

Review Comment:
   In the future, we might have even more types of bucket layouts added, which 
will need their own layout features. Since this version is introducing the 
concept of bucket layouts as well as the OBS and FSO layout types, I think we 
should update the description string to clarify that these are the layout types 
brought in with this feature, something like this:
   `"Ozone version supporting bucket layouts and introducing the FSO and OBS 
bucket layout types."`



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

Reply via email to