macdoor615 created FLINK-39485:
----------------------------------

             Summary: NativeS3FileSystem: support bucket-root paths (empty 
object key) using HeadBucket instead of HeadObject
                 Key: FLINK-39485
                 URL: https://issues.apache.org/jira/browse/FLINK-39485
             Project: Flink
          Issue Type: Bug
          Components: FileSystems
    Affects Versions: 2.3.0
         Environment: Flink 2.3.x + flink-s3-fs-native + MinIO/S3-compatible 
endpoint as the deployment where catalog creation was tested.
            Reporter: macdoor615
             Fix For: 2.3.0


h2. Problem

Creating a catalog or checking existence for a warehouse URI of the form 
{{s3://my-bucket}} (no object prefix) fails with AWS SDK v2:
{code:java}
SdkClientException: Unable to marshall request to JSON: Key cannot be empty.
Caused by: IllegalArgumentException: Key cannot be empty.{code}
{{NativeS3FileSystem.getFileStatus}} always builds a {{HeadObject}} request. 
For the bucket root, {{NativeS3AccessHelper.extractKey}} returns an empty 
string, which is invalid for {{{}HeadObject{}}}.
h2. Expected behavior

Bucket root should resolve to a directory status if the bucket exists, e.g. by 
using {{HeadBucket}} (or an equivalent check), and listing semantics for the 
empty prefix should remain correct.
h2. Related

{{getDirectoryStatus}} should use prefix {{""}} for an empty key, not 
{{{}"/"{}}}, when listing the bucket root.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to