adoroszlai commented on code in PR #8399:
URL: https://github.com/apache/ozone/pull/8399#discussion_r2096913492


##########
hadoop-ozone/dist/src/main/smoketest/s3/awss3.robot:
##########
@@ -46,6 +46,10 @@ File upload and directory list
                         Should not contain        ${result}         testfile
                         Should not contain        ${result}         dir1
                         Should contain            ${result}         file
+                        # Verify S3 storage class if file is replicated or 
erasure coded.
+    ${result} =         Execute AWSS3CliDebug   ls 
s3://${BUCKET}/dir1/dir2/file
+                        Run Keyword If      '${BUCKET}' == 'generated'    
Should contain    ${result}    STANDARD

Review Comment:
   I don't think `'${BUCKET}' == 'generated'` will be true here, because suite 
setup replaces `generated` with random bucket name.  May be better to use [`IF 
... 
ELSE`](https://robotframework.org/robotframework/6.1.1/RobotFrameworkUserGuide.html#if-else-syntax)
 instead.
   
   Also, this assertion would pass for `STANDARD_IA`, too.



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/S3StorageType.java:
##########
@@ -18,67 +18,34 @@
 package org.apache.hadoop.ozone.s3.util;
 
 import org.apache.hadoop.hdds.client.ECReplicationConfig;
+import org.apache.hadoop.hdds.client.RatisReplicationConfig;
 import org.apache.hadoop.hdds.client.ReplicationConfig;
-import org.apache.hadoop.hdds.client.ReplicationFactor;
-import org.apache.hadoop.hdds.client.ReplicationType;
-import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
-import org.apache.hadoop.ozone.OzoneConfigKeys;
 
 /**
  * Maps S3 storage class values to Ozone replication values.
  */
 
 public enum S3StorageType {
 
-  REDUCED_REDUNDANCY(ReplicationType.RATIS, ReplicationFactor.ONE),
-  STANDARD(ReplicationType.RATIS, ReplicationFactor.THREE);
+  
REDUCED_REDUNDANCY(RatisReplicationConfig.getInstance(HddsProtos.ReplicationFactor.ONE)),
+  STANDARD(
+      RatisReplicationConfig.getInstance(HddsProtos.ReplicationFactor.THREE)),
+  STANDARD_IA(new ECReplicationConfig(ECReplicationConfig.EcCodec.RS + 
"-3-2-1024k"));

Review Comment:
   nit:
   
   ```suggestion
     STANDARD_IA(new ECReplicationConfig(3, 2));
   ```



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -857,21 +861,20 @@ public Response initializeMultipartUpload(
   }
 
   private ReplicationConfig getReplicationConfig(OzoneBucket ozoneBucket,
-      String storageType) throws OS3Exception {
-    if (StringUtils.isEmpty(storageType)) {
-      S3StorageType defaultStorageType = 
S3StorageType.getDefault(ozoneConfiguration);
-      storageType = (defaultStorageType != null ? 
defaultStorageType.toString() : null);
-    }
+      String storageType, String storageConfig) throws OS3Exception {
 
     ReplicationConfig clientConfiguredReplicationConfig = null;
     String replication = ozoneConfiguration.get(OZONE_REPLICATION);
+
     if (replication != null) {
-      clientConfiguredReplicationConfig = ReplicationConfig.parse(
-          ReplicationType.valueOf(ozoneConfiguration
-              .get(OZONE_REPLICATION_TYPE, OZONE_REPLICATION_TYPE_DEFAULT)),
-          replication, ozoneConfiguration);
+      ReplicationType replicationType = ReplicationType.valueOf(
+          ozoneConfiguration.get(OZONE_REPLICATION_TYPE, 
OZONE_REPLICATION_TYPE_DEFAULT));
+      clientConfiguredReplicationConfig =
+          (replicationType == ReplicationType.EC) ?
+              new ECReplicationConfig(replication) : ReplicationConfig.parse(
+              replicationType, replication, ozoneConfiguration);
     }

Review Comment:
   I think this can be simplified to:
   
   ```java
   ReplicationConfig clientConfiguredReplicationConfig = 
OzoneClientUtils.getClientConfiguredReplicationConfig(ozoneConfiguration);
   ```



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