Gargi-jais11 commented on code in PR #11867:
URL: https://github.com/apache/ozone/pull/11867#discussion_r4463929728


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/S3StorageClassResolver.java:
##########
@@ -95,9 +102,42 @@ public S3StorageClassSpec toSpec(String s3StorageClass) {
     }
   }
 
+  /**
+   * Resolves replication for a request, including the STANDARD client-default 
setting.
+   *
+   * <p>When the setting is enabled and the request specifies STANDARD, a 
non-null client replication config is used
+   * unchanged, including its EC layout. The storage-config header and bucket 
replication do not override it.
+   * Otherwise, explicit classes use their spec's replication rules. A missing 
or empty class header uses client
+   * replication, then bucket replication, or null so the server can apply its 
default.
+   * For explicit classes, storage policy is resolved separately through 
{@link #toSpec} and is unaffected.
+   *
+   * @param s3StorageClass the x-amz-storage-class header value, or null
+   * @param storageConfigHeader the storage-config header value, or null
+   * @param clientReplicationConfig replication from the gateway's 
ozone.replication settings, or null
+   * @param bucketReplicationConfig the bucket's default replication, or null
+   * @return the resolved replication, or null to use the server default
+   * @throws IllegalArgumentException if the class is unknown or its EC layout 
header is invalid
+   */
+  @Nullable
+  public ReplicationConfig resolveReplicationConfig(@Nullable String 
s3StorageClass,

Review Comment:
   This method has no production caller yet. 
`EndpointBase.getReplicationConfig` around (line 843) still calls 
`S3Utils.resolveS3ClientSideReplicationConfig,` which already honours this 
setting, so the same logic now lives in two places. and the bhaviour is 
difference:
   
   - An unknown class for eg. xyz-class gives OS3Exception 
INVALID_STORAGE_CLASS (400) there, but a plain IllegalArgumentException here. 
If the write path switches without mapping it, clients would get 500 instead of 
400.
   - STANDARD_IA without storage-config on an EC bucket gives EC 3-2 there, but 
the bucket's EC layout here.
   
   Could we switch EndpointBase to this method and remove the S3Utils copy in 
this PR, with the error mapped to INVALID_STORAGE_CLASS? Or I am okay with the 
follow-up PR as well.



##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -2145,7 +2145,10 @@
     <description>
       When true, a request with x-amz-storage-class STANDARD uses 
ozone.replication and
       ozone.replication.type, if ozone.replication is set, instead of 
RATIS/THREE.
+      Other storage classes and storage policies are unaffected.
       The ozone local runtime sets it to true.
+      S3StorageClassResolver reads this setting at gateway startup; restart

Review Comment:
   nit: users don't know S3StorageClassResolver.
   Better to write like this "S3 Gateway reads this setting at startup; restart 
S3 Gateway after changing it." 



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