adoroszlai opened a new pull request, #6452:
URL: https://github.com/apache/ozone/pull/6452
## What changes were proposed in this pull request?
Fix a bug where attempting to create empty file in FSO bucket via S3 Gateway
results in creation of a directory.
```
$ ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED /s3v/fso-bucket
$ hdfs dfs -touch s3a://fso-bucket/empty.s3a
$ ozone sh key info /s3v/fso-bucket/empty.s3a
{
"name" : "empty.s3a/",
"dataSize" : 0,
...
"ozoneKeyLocations" : [ ],
"file" : false
}
```
The same works OK in `OBJECT_STORE` and `LEGACY` buckets.
It was broken by HDDS-7594, which fixed a bug where attempt to create
directory through S3G created files instead. In other words, prior behavior
was also wrong, just the other way around.
https://issues.apache.org/jira/browse/HDDS-10570
## How was this patch tested?
Added test case in unit test (`TestObjectPut`).
Changed acceptance tests to run tests on all three bucket layout types.
Also tested manually:
```
$ ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED /s3v/fso-bucket
$ export AWS_ACCESS_KEY_ID=any AWS_SECRET_KEY=any
$ export
OZONE_CLASSPATH=aws-java-sdk-bundle-1.12.367.jar:hadoop-aws-3.3.6.jar
$ ozone fs -Dfs.s3a.path.style.access=true -Dfs.s3a.endpoint=http://s3g:9878
\
-touch s3a://fso-bucket/empty.file
$ ozone fs -Dfs.s3a.path.style.access=true -Dfs.s3a.endpoint=http://s3g:9878
\
-mkdir s3a://fso-bucket/dir
$ ozone fs -ls ofs://om/s3v/fso-bucket/
Found 2 items
drwxrwxrwx - hadoop hadoop 0 2024-03-27 21:15
ofs://om/s3v/fso-bucket/dir
-rw-rw-rw- 3 hadoop hadoop 0 2024-03-27 21:15
ofs://om/s3v/fso-bucket/empty.file
$ ozone sh key info /s3v/fso-bucket/dir/
{
"name" : "dir/",
"dataSize" : 0,
...
"ozoneKeyLocations" : [ ],
"file" : false
}
$ ozone sh key info /s3v/fso-bucket/empty.file
{
"name" : "empty.file",
"dataSize" : 0,
...
"ozoneKeyLocations" : [ ],
"file" : true
}
```
CI:
https://github.com/adoroszlai/ozone/actions/runs/8456929496
--
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]