Skip to content
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

Fix PutLifecycleConfiguration's Prefix field #228

Merged
merged 2 commits into from
May 9, 2024

Conversation

Shunpoco
Copy link
Collaborator

@Shunpoco Shunpoco commented May 9, 2024

Description of your changes

This PR fixes the relationship between Prefix field and Filter field in LifecycleRule.

Currently, if a client want to set a LifecycleConfiguration with Prefix but without Filter, RGW can't take the Prefix field. It causes that the LifecycleConfiguration affects entire objects in the bucket.
Because:

  1. RGW first checks if it can decode Filter field, then if not RGW tries if it can decode Prefix (Please see here)
  2. In our current GenerateLifecycleRules implementation, even if a client doesn't specify any Filter, the function sets empty LifecycleRuleFilterMemberPrefix instance.
  3. Because RGW just checks if it can encode Filter field or not in the if-statement above, the empty LifecycleRuleFilterMemberPrefix instance is encoded and eventually Prefix field is dropped.

I have:

  • Run make reviewable to ensure this PR is ready for review.
  • Run make ceph-chainsaw to validate these changes against Ceph. This step is not always necessary. However, for changes related to S3 calls it is sensible to validate against an actual Ceph cluster. Localstack is used in our CI Chainsaw suite for convenience and there can be disparity in S3 behaviours betwee it and Ceph. See docs/TESTING.md for information on how to run tests against a Ceph cluster.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

@Shunpoco Shunpoco marked this pull request as ready for review May 9, 2024 11:37
@Shunpoco Shunpoco requested a review from nolancon May 9, 2024 11:37
Copy link
Collaborator

@nolancon nolancon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! 🚀

@Shunpoco Shunpoco merged commit c771439 into main May 9, 2024
11 checks passed
@Shunpoco Shunpoco deleted the fix-put-lifecycle-configuration-prefix branch May 9, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants