-
Notifications
You must be signed in to change notification settings - Fork 590
HDDS-12911. Key deletion should not validate the name #8453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, @sreejasahithi.
I tested the validation, and it works as expected.
Currently, characters like ,, ., .., etc., are allowed during the put-object operation, and delete-object is able to handle such entries unlike the : case. We can leave these as is for now and focus only on excluding : as implemented.
cc: @nandakumar131
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
Outdated
Show resolved
Hide resolved
…ad of splitting and made error message robust
|
I looked into this and the reason for the corner case of put-object allowing a key like "sample:/" is because if the --body is not provided , it gets translated into a CreateDirectory operation for an FSO bucket $ aws s3api --endpoint http://xx:9878 put-object --bucket buck2 --key sample:/
$ aws s3api --endpoint http://xx:9878 delete-object --bucket buck2 --key sample:/
An error occurred (500) when calling the DeleteObject operation (reached max retries: 2): Internal Server ErrorThe keyName check is controlled by a flag ozone.om.keyname.character.check.enabled which was introduced here and defaults to false. To not allow these chars in the first place, I feel one should tune this config to true for stricter char check or we could even change default to true. @adoroszlai what do you think?. |
|
Thanks @sadanand48, @sarvekshayr, @sreejasahithi for the discussion so far, and sorry for the delayed response. Can we continue allowing
CC @ivandika3 |
Yeah we should keep the behaviour consistent b/w create and delete. Both use different methods to validate key name today causing the discrepancy. The validation for extra chars should only be done during create/rename key if the strict check flag is switched on and not do this validation on delete or any other API |
|
+1 on not restricting the naming without understanding fully the possible regressions and instead fixing the specific case. |
|
Agree that we should be able to delete existing keys and any new restrictions on key names should be behind the character check strictness flag. |
|
Currently, validateAndNormalizeKey is used by both Since key name validation is not necessary during delete operations, because we should be able to delete any key that was allowed to be created. To address this, I propose introducing a separate method for normalizing key paths specifically for Alternatively, we could instead add a check for CC @adoroszlai , @sadanand48 , @ivandika3 , @SaketaChalamchala |
|
Yes @sreejasahithi we should modify the code to have a similar behaviour as the method added in HDDS-13262, basically maintain consistent behaviour for these checks. |
sadanand48
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sreejasahithi for updating the patch. I am okay with this patch which unblocks delete of keys with special chars.
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...e/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyDeleteRequest.java
Outdated
Show resolved
Hide resolved
|
The newly added testcase |
|
I have fixed the testcase issue. |
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
adoroszlai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sreejasahithi for updating the patch.
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...op-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
Outdated
Show resolved
Hide resolved
...ager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyDeleteRequestWithFSO.java
Show resolved
Hide resolved
...ager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyDeleteRequestWithFSO.java
Outdated
Show resolved
Hide resolved
...ager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyDeleteRequestWithFSO.java
Outdated
Show resolved
Hide resolved
…alidiation in normalizeKeyPath
|
Thanks @sreejasahithi for the patch, @adoroszlai @SaketaChalamchala @ivandika3 @sarvekshayr for the reviews and discussions. |
What changes were proposed in this pull request?
AWS S3 PutObject API allows creating keys and directories with names containing invalid characters, but delete operation fails to remove such invalid objects from a FSO bucket. Hence to resolve this issue, key name validation should not be done during the key deletion.
For example :
Before :
aws s3api --endpoint http://localhost:9878/ put-object --bucket fsobuck --key sampledir:1/ --no-verify-sslthis has no error and gets created successfully.
but when we try to delete it we get an error as follows,
An error occurred (500) when calling the DeleteObject operation (reached max retries: 4): Internal Server ErrorWhat is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-12911
How was this patch tested?
https://github.com/sreejasahithi/ozone/actions/runs/15020991860
This change was also tested locally over a docker ozone cluster.
Added a testcase in TestOMKeyDeleteRequestWithFSO.java