devmadhuu commented on code in PR #11867:
URL: https://github.com/apache/ozone/pull/11867#discussion_r4464459479


##########
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:
   Thanks, you’re right that the resolver method has no production caller yet. 
#11229 (HDDS-16039) introduced the resolver as infrastructure, with the S3 read 
and write paths to be connected in follow-up PR because before wiring the code 
for writes and reads, I do not want to break the existing functionality. So 
keeping it modular in small PRs.
   
   On your below concern, I have fixed the error.
   `_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:
   Done.



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