[ 
https://issues.apache.org/jira/browse/HDDS-7030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17762349#comment-17762349
 ] 

zingtc commented on HDDS-7030:
------------------------------

hello [~aryangupta1998] [~ritesh] 

I may miss some condition: S3 client can not delete directory when the 
directory has sub files with  LEGACY or FSO  bucket layout .

OBJECT_STORE works well.

demo code
{code:python}
## fso is the same as legacy
client.put_object(Bucket='fs0', Key='dict3/123.txt') # ok
client.delete_object(Bucket='fso', Key='dict3/') # can not delete    

# create a directory and put a file into it
client.put_object(Bucket='fso', Key='dict4/')
client.put_object(Bucket='fso', Key='dict4/123.txt') # error An error occurred 
(InvalidRequest) when calling the PutObject/MPU PartUpload operation: 
ozone.om.enable.filesystem.paths is enabled Keys are considered as Unix Paths. 
Path has Violated FS Semantics which caused put operation to fail.

## obs all works well
client.put_object(Bucket='obs', Key='dict4/')
client.put_object(Bucket='obs', Key='dict4/123.txt')
client.delete_object(Bucket='obs', Key='dict4/') # delete directory success

{code}
Now I use OBJECT_STORE bucket type when managing files using s3 client.

> can not use boto3(python) to create or delete directory through s3gateway
> -------------------------------------------------------------------------
>
>                 Key: HDDS-7030
>                 URL: https://issues.apache.org/jira/browse/HDDS-7030
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: S3
>    Affects Versions: 1.3.0
>         Environment: ozone related config
> ozone.om.enable.filesystem.paths:true
> ozone.om.metadata.layout:PREFIX
>            Reporter: zingtc
>            Assignee: Aryan Gupta
>            Priority: Major
>
>  I use boto3 to create/delete/rename a directory,but get some results not 
> expected.
> demo code:
> import boto3
> client = boto3.client(service_name='s3', aws_access_key_id='xxx',
> aws_secret_access_key='xxx',
> region_name='s3v', use_ssl=False,
> endpoint_url='[http://xxx:32078')|http://xxx:32078')/]
>  # want to create directory but get a file
> client.put_object(Bucket='test', Key='dict3/')
>  # want to delete directory but not deleted, response HTTPStatusCode: 204
>  # the directory was created by ozone command: ozone fs -mkdir /s3v/test/777
> client.delete_object(Bucket='test', Key='777/')
> #  but not deleted response: HTTPStatusCode: 204
> client.delete_object(Bucket='test', Key='777')



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to