You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "mladjan-gadzic (via GitHub)" <gi...@apache.org> on 2023/03/22 12:10:29 UTC

[GitHub] [ozone] mladjan-gadzic opened a new pull request, #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

mladjan-gadzic opened a new pull request, #4448:
URL: https://github.com/apache/ozone/pull/4448

   ## What changes were proposed in this pull request?
   
   s3g currently says:
   - /volume/bucket/dir/  exists.
   - /volume/bucket/dir  exists.
   
   s3a is expecting:
   - /volume/bucket/dir/  exists.
   - /volume/bucket/dir  does not exist.
   
   Proposed is an implementation to resolve the issue and to cover corner cases to support fso folders over s3g by modifying the s3g ObjectEndpoint to check whether the requested path is a directory, if so, to only return ok if path has trailing '/'.  This would support s3 Head requests and Get requests.  The type of object, where file or directory is determined in the head-object and get-object request through checking the keyInfo (modifying the OzoneKey and OzoneKeyDetails) isFile().
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7922
   
   ## How was this patch tested?
   
   - manual
   - unit
   - smoke
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] SaketaChalamchala commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "SaketaChalamchala (via GitHub)" <gi...@apache.org>.
SaketaChalamchala commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1157954294


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   This might be happening because all zero byte objects are created as directories in FSO bucket. Would it make sense to also make sure that `put-object --key f1/zero`(without trailing /) creates a file and `put-object --key f1/zero/`(with trailing /) creates a directory in FSO bucket?
   
   ```
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso --key f1/  ## creates f1/ directory.
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso --key f1/zero --body zero  ## zero is a 0 byte file. creates f1/zero/ dir.
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso --key f1/test --body test ## test is an 8 byte file. creates f1/test file.
   
   sh-4.2$ ozone sh key list /s3v/fso
   [ {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/",
     "dataSize" : 0,
     "creationTime" : "2023-04-05T02:11:23.723Z",
     "modificationTime" : "2023-04-05T02:11:23.723Z",
   ...
   }, {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/test",
     "dataSize" : 8,
   ...
   }, {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/zero/",
     "dataSize" : 0,
   ...
   }
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] smengcl commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1157848318


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   @SaketaChalamchala and I just had a brief offline discussion. We think it is strange to return `NoSuchKey` for FSO bucket in this case. The intended behavior should be the same as OBS or LEGACY bucket.
   
   Any idea why this is the case currently? Is it feasible to fix this?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] whbing commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "whbing (via GitHub)" <gi...@apache.org>.
whbing commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1217497542


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java:
##########
@@ -224,4 +227,26 @@ private void setDefaultHeader() {
     doReturn(CONTENT_ENCODING1)
         .when(headers).getHeaderString("Content-Encoding");
   }
+
+  @Test
+  public void testGetWhenKeyIsDirectoryAndDoesNotEndWithASlash()
+      throws IOException {
+    // GIVEN
+    final String bucketName = "b1";
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    rest.setOzoneConfiguration(config);
+    OzoneBucket bucket = client.getObjectStore().getS3Bucket(bucketName);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final OS3Exception ex =
+        Assertions.assertThrows(OS3Exception.class,
+            () -> rest.get(bucketName, keyPath, null, 0, null, body));

Review Comment:
   variable `body` not found in my env (pull from master branch and merged this pr). I'm not sure where is `body` defined.
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] smengcl merged pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #4448:
URL: https://github.com/apache/ozone/pull/4448


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] duongkame commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "duongkame (via GitHub)" <gi...@apache.org>.
duongkame commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1152280809


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -462,6 +476,20 @@ public Response head(
     OzoneKey key;
     try {
       key = getClientProtocol().headS3Object(bucketName, keyPath);
+
+      /*
+        Necessary for directories in buckets with FSO layout.
+        Intended for apps which use Hadoop S3A.
+        Example of such app is Trino (through Hive connector).
+       */
+      boolean isFsoDirCreationEnabled = ozoneConfiguration

Review Comment:
   nit: to avoid duplication, this can be extracted as a function with `isFile` and `keyPath` as parameters.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] tanvipenumudy commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "tanvipenumudy (via GitHub)" <gi...@apache.org>.
tanvipenumudy commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1155474981


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectHead.java:
##########
@@ -101,4 +105,64 @@ public void testHeadFailByBadName() throws Exception {
       Assert.assertEquals(HTTP_NOT_FOUND, ex.getHttpCode());
     }
   }
+
+  @Test
+  public void testHeadWhenKeyIsAFileAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    String keyContent = "content";
+    OzoneOutputStream out = bucket.createKey(keyPath,
+        keyContent.getBytes(UTF_8).length,
+        ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS,
+            ReplicationFactor.ONE), new HashMap<>());
+    out.write(keyContent.getBytes(UTF_8));
+    out.close();
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+
+  @Test
+  public void testHeadWhenKeyIsDirectoryAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+
+  @Test
+  public void testHeadWhenKeyIsDirectoryAndKeyPathEndsWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir/";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }

Review Comment:
   ```suggestion
     }
     
     @Test
     public void testHeadWhenKeyIsAFileAndKeyPathEndsWithASlash()
         throws IOException, OS3Exception {
       // GIVEN
       final String keyPath = "keyFile";
       OzoneConfiguration config = new OzoneConfiguration();
       config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
       keyEndpoint.setOzoneConfiguration(config);
       String keyContent = "content";
       OzoneOutputStream out = bucket.createKey(keyPath,
           keyContent.getBytes(UTF_8).length,
           ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS,
               ReplicationFactor.ONE), new HashMap<>());
       out.write(keyContent.getBytes(UTF_8));
       out.close();
   
       // WHEN
       final Response response = keyEndpoint.head(bucketName, keyPath + "/");
   
       // THEN
       Assertions.assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
       bucket.deleteKey(keyPath);
     }
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1217633737


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java:
##########
@@ -224,4 +227,26 @@ private void setDefaultHeader() {
     doReturn(CONTENT_ENCODING1)
         .when(headers).getHeaderString("Content-Encoding");
   }
+
+  @Test
+  public void testGetWhenKeyIsDirectoryAndDoesNotEndWithASlash()
+      throws IOException {
+    // GIVEN
+    final String bucketName = "b1";
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    rest.setOzoneConfiguration(config);
+    OzoneBucket bucket = client.getObjectStore().getS3Bucket(bucketName);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final OS3Exception ex =
+        Assertions.assertThrows(OS3Exception.class,
+            () -> rest.get(bucketName, keyPath, null, 0, null, body));

Review Comment:
   Thanks for looking into it! 
   
   It is connected with [https://github.com/apache/ozone/commit/ac42bf0c779a46920971fb4f0d8c8bbe7f2171a7#diff-fa46c2b691ace246572f975dc2119ab738a19d283ac7848d35e78e8a2709af96L73](https://github.com/apache/ozone/commit/ac42bf0c779a46920971fb4f0d8c8bbe7f2171a7#diff-fa46c2b691ace246572f975dc2119ab738a19d283ac7848d35e78e8a2709af96L73) change. I merged upstream/master and resolved conflicts. It should be fine now.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] duongkame commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "duongkame (via GitHub)" <gi...@apache.org>.
duongkame commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1152280809


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -462,6 +476,20 @@ public Response head(
     OzoneKey key;
     try {
       key = getClientProtocol().headS3Object(bucketName, keyPath);
+
+      /*
+        Necessary for directories in buckets with FSO layout.
+        Intended for apps which use Hadoop S3A.
+        Example of such app is Trino (through Hive connector).
+       */
+      boolean isFsoDirCreationEnabled = ozoneConfiguration

Review Comment:
   nit: to avoid duplication, this block can be extracted as a function with `isFile` and `keyPath` as parameters.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] hemantk-12 commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "hemantk-12 (via GitHub)" <gi...@apache.org>.
hemantk-12 commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1152314281


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -462,6 +476,20 @@ public Response head(
     OzoneKey key;
     try {
       key = getClientProtocol().headS3Object(bucketName, keyPath);
+
+      /*
+        Necessary for directories in buckets with FSO layout.
+        Intended for apps which use Hadoop S3A.
+        Example of such app is Trino (through Hive connector).
+       */
+      boolean isFsoDirCreationEnabled = ozoneConfiguration
+          .getBoolean(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED,
+              OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED_DEFAULT);
+      if (isFsoDirCreationEnabled &&
+          !key.isFile() &&
+          !keyPath.endsWith("/")) {
+        throw new OMException(ResultCodes.KEY_NOT_FOUND);
+      }

Review Comment:
   Lines 480-492 are duplicate of 321-334. Can be moved to a helper function.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneKey.java:
##########
@@ -61,45 +60,38 @@ public class OzoneKey {
   private ReplicationConfig replicationConfig;
 
   private Map<String, String> metadata = new HashMap<>();
+
   /**
-   * Constructs OzoneKey from OmKeyInfo.
-   *
+   * Indicator if key is a file.
    */
-  @SuppressWarnings("parameternumber")
-  @Deprecated
-  public OzoneKey(String volumeName, String bucketName,
-                  String keyName, long size, long creationTime,
-                  long modificationTime, ReplicationType type,
-                  int replicationFactor) {
-    this(volumeName, bucketName, keyName, size, creationTime, modificationTime,
-            ReplicationConfig.fromTypeAndFactor(type,
-                    ReplicationFactor.valueOf(replicationFactor)));
-  }
+  private final boolean isFile;
 
   /**
    * Constructs OzoneKey from OmKeyInfo.
    *
    */
   @SuppressWarnings("parameternumber")
   public OzoneKey(String volumeName, String bucketName,
-                  String keyName, long size, long creationTime,
-                  long modificationTime, ReplicationConfig replicationConfig) {
+      String keyName, long size, long creationTime,
+      long modificationTime, ReplicationConfig replicationConfig,
+      boolean isFile) {
     this.volumeName = volumeName;
     this.bucketName = bucketName;
     this.name = keyName;
     this.dataSize = size;
     this.creationTime = Instant.ofEpochMilli(creationTime);
     this.modificationTime = Instant.ofEpochMilli(modificationTime);
     this.replicationConfig = replicationConfig;
+    this.isFile = isFile;
   }
 
   @SuppressWarnings("parameternumber")
   public OzoneKey(String volumeName, String bucketName,
-                  String keyName, long size, long creationTime,
-                  long modificationTime, ReplicationConfig replicationConfig,
-                  Map<String, String> metadata) {
+      String keyName, long size, long creationTime,

Review Comment:
   nit: I think it was properly indented previously. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] kerneltime commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1485431723

   cc @SaketaChalamchala @hemantk-12 @tanvipenumudy 


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] smengcl commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1246903136


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   Thanks @mladjan-gadzic 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1217633737


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java:
##########
@@ -224,4 +227,26 @@ private void setDefaultHeader() {
     doReturn(CONTENT_ENCODING1)
         .when(headers).getHeaderString("Content-Encoding");
   }
+
+  @Test
+  public void testGetWhenKeyIsDirectoryAndDoesNotEndWithASlash()
+      throws IOException {
+    // GIVEN
+    final String bucketName = "b1";
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    rest.setOzoneConfiguration(config);
+    OzoneBucket bucket = client.getObjectStore().getS3Bucket(bucketName);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final OS3Exception ex =
+        Assertions.assertThrows(OS3Exception.class,
+            () -> rest.get(bucketName, keyPath, null, 0, null, body));

Review Comment:
   It is connected with [https://github.com/apache/ozone/commit/ac42bf0c779a46920971fb4f0d8c8bbe7f2171a7#diff-fa46c2b691ace246572f975dc2119ab738a19d283ac7848d35e78e8a2709af96L73](https://github.com/apache/ozone/commit/ac42bf0c779a46920971fb4f0d8c8bbe7f2171a7#diff-fa46c2b691ace246572f975dc2119ab738a19d283ac7848d35e78e8a2709af96L73) change. I merged upstream/master and resolved conflicts. It should be fine now.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] SaketaChalamchala commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "SaketaChalamchala (via GitHub)" <gi...@apache.org>.
SaketaChalamchala commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1160902119


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   Yes, it does. Thanks for clarifying.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1614674724

   Thank you @smengcl for the review. I merged upstream/master and resolved conflicts. [CI](https://github.com/mladjan-gadzic/ozone/actions/runs/5421667679) on my fork passed. Unfortunatelly I do not have a permission to run CI on upstream. If you could do so, that would be great!


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1159408294


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   > @SaketaChalamchala and I just had a brief offline discussion. We think it is strange to return `NoSuchKey` for FSO bucket in this case. The intended behavior should be the same as OBS or LEGACY bucket that returns `InvalidRange`.
   
   I agree FSO should have the same behavior as OBS or LEGACY. However, in order for it to be s3A compatible this is what is needed. Did quite a few tests, and this fixes it. 
   
   > Any idea why this is the case currently? Is it feasible to fix this?
   
   It has to do with internal path normalization for FSO, trailing slashes and what s3A expects as response.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] smengcl commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1157848318


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   @SaketaChalamchala and I just had a brief offline discussion. We think it is strange to return `NoSuchKey` for FSO bucket in this case. The intended behavior should be the same as OBS or LEGACY bucket that returns `InvalidRange`.
   
   Any idea why this is the case currently? Is it feasible to fix this?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] DaveTeng0 commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "DaveTeng0 (via GitHub)" <gi...@apache.org>.
DaveTeng0 commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1612467874

   @mladjan-gadzic I saw an integration test (filesystem) failure, could you help take a look? Thanks.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1612638184

   > @mladjan-gadzic I saw an integration test (filesystem) failure, could you help take a look? Thanks.
   
   @DaveTeng0 thanks for having a look! Failing tests are part of already known issue which has its own Jira https://issues.apache.org/jira/browse/HDDS-8526.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] smengcl commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1615185071

   Thanks @duongkame @hemantk-12 @tanvipenumudy @whbing @DaveTeng0 for reviewing this.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1489981531

   @duongkame @hemantk-12 thank you for the review!


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] tanvipenumudy commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "tanvipenumudy (via GitHub)" <gi...@apache.org>.
tanvipenumudy commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1155477356


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectHead.java:
##########
@@ -101,4 +105,64 @@ public void testHeadFailByBadName() throws Exception {
       Assert.assertEquals(HTTP_NOT_FOUND, ex.getHttpCode());
     }
   }
+
+  @Test
+  public void testHeadWhenKeyIsAFileAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    String keyContent = "content";
+    OzoneOutputStream out = bucket.createKey(keyPath,
+        keyContent.getBytes(UTF_8).length,
+        ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS,
+            ReplicationFactor.ONE), new HashMap<>());
+    out.write(keyContent.getBytes(UTF_8));
+    out.close();
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+
+  @Test
+  public void testHeadWhenKeyIsDirectoryAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+
+  @Test
+  public void testHeadWhenKeyIsDirectoryAndKeyPathEndsWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir/";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }

Review Comment:
   Could we consider including a test case that verifies the behavior when attempting to retrieve metadata for a file using a key path that ends with a slash ("/")? The expected behavior is that the request should fail with a 404 status code since the specified key path does not correspond to a directory.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] tanvipenumudy commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "tanvipenumudy (via GitHub)" <gi...@apache.org>.
tanvipenumudy commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1155474316


##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectHead.java:
##########
@@ -101,4 +105,64 @@ public void testHeadFailByBadName() throws Exception {
       Assert.assertEquals(HTTP_NOT_FOUND, ex.getHttpCode());
     }
   }
+
+  @Test
+  public void testHeadWhenKeyIsAFileAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    String keyContent = "content";
+    OzoneOutputStream out = bucket.createKey(keyPath,
+        keyContent.getBytes(UTF_8).length,
+        ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS,
+            ReplicationFactor.ONE), new HashMap<>());
+    out.write(keyContent.getBytes(UTF_8));
+    out.close();
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_OK, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+
+  @Test
+  public void testHeadWhenKeyIsDirectoryAndKeyPathDoesNotEndWithASlash()
+      throws IOException, OS3Exception {
+    // GIVEN
+    final String keyPath = "keyDir";
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
+    keyEndpoint.setOzoneConfiguration(config);
+    bucket.createDirectory(keyPath);
+
+    // WHEN
+    final Response response = keyEndpoint.head(bucketName, keyPath);
+
+    // THEN
+    Assertions.assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
+    bucket.deleteKey(keyPath);
+  }
+

Review Comment:
   ```suggestion
     @Test
     public void testHeadWhenKeyIsAFileAndKeyPathEndsWithASlash()
         throws IOException, OS3Exception {
       // GIVEN
       final String keyPath = "keyFile";
       OzoneConfiguration config = new OzoneConfiguration();
       config.set(OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED, "true");
       keyEndpoint.setOzoneConfiguration(config);
       String keyContent = "content";
       OzoneOutputStream out = bucket.createKey(keyPath,
           keyContent.getBytes(UTF_8).length,
           ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS,
               ReplicationFactor.ONE), new HashMap<>());
       out.write(keyContent.getBytes(UTF_8));
       out.close();
   
       // WHEN
       final Response response = keyEndpoint.head(bucketName, keyPath + "/");
   
       // THEN
       Assertions.assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
       bucket.deleteKey(keyPath);
     }
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1494110445

   @tanvipenumudy thanks for the review! Adding one more test for above-mentioned case makes perfect sense.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on a diff in pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1159451193


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}            ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        InvalidRange
+    ${result} =			        Execute                    ozone sh bucket info /s3v/${BUCKET}
+    ${linked} = 		        Execute				       echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} = 			        Evaluate			       "source" in """${linked}"""
+    	      			        IF	${eval} == ${True}
+    ${result} =                 Execute				       ozone sh bucket info ${linked}
+				                END
+    ${fsolayout} =    		    Evaluate    	   	       "OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range bytes=0-0 /tmp/testfile2.result   255
+    	      			        IF 	${fsolayout} == ${True}
+                                Should contain              ${result}       NoSuchKey
+				                ELSE
+                                Should contain              ${result}       InvalidRange
+				                END

Review Comment:
   > This might be happening because all zero byte objects are created as directories in FSO bucket. 
   
   This is a different issue. It has to do with what s3A expects as a response and what s3G returns. 
   
   > Would it make sense to also make sure that `put-object --key f1/zero`(without trailing /) creates a file and `put-object --key f1/zero/`(with trailing /) creates a directory in FSO bucket?
   
   This could be an idea for additional guard for dir creation. However, I am not sure if it is necessarry because there is already a flag `OZONE_S3G_FSO_DIRECTORY_CREATION_ENABLED` for that. I'd say, right now there is enough room for someone to decide whether a dir or a file should be created (based on [checks](https://github.com/apache/ozone/blob/master/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java#L216)).
   
   Does this make sense?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] mladjan-gadzic commented on pull request #4448: HDDS-7922. [FSO] S3G folder support fso layout filestatus s3A compatibility

Posted by "mladjan-gadzic (via GitHub)" <gi...@apache.org>.
mladjan-gadzic commented on PR #4448:
URL: https://github.com/apache/ozone/pull/4448#issuecomment-1612025894

   @kerneltime any chance we can get a motion on this PR? It's been a while and all the comments have been addressed.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org