Repository navigation
rgw/lc: report x-amz-expiration only for the current version - #69642
Conversation
The x-amz-expiration response header describes the current-version
Expiration lifecycle action for an object. s3_expiration_header() instead
selected between the Expiration and the NoncurrentVersionExpiration rule
based on whether the object key carried an instance id:
const LCExpiration& rule_expiration =
(obj_key.instance.empty()) ? expiration : noncur_expiration;
This was wrong in two ways. OLH resolution writes the current version's
instance id into the key before the header is computed, so even a plain
GET/HEAD of the current version (no versionId) was treated as a
non-current request and reported a NoncurrentVersionExpiration rule. And
x-amz-expiration is not meant to surface NoncurrentVersionExpiration at
all. A versioned bucket whose only rule was NoncurrentVersionExpiration
therefore returned a bogus expiry-date and rule-id on the current object,
for both a plain request and a versionId request.
Compute the header from the current-version Expiration rule only, and
return no header when the request targets a specific version. The header
helper now passes the client request key (s->object_key) rather than the
OLH-resolved key, so a plain GET/HEAD of the current version is no longer
misclassified as a versioned request.
Add a unit test covering a noncurrent-only policy (no header for either a
plain or a versioned request) and a combined policy (the current
Expiration rule for the current version, no header for a versionId
request).
Tracker: https://tracker.ceph.com/issues/77564
Reported-by: Saravanan Palanisamy
Signed-off-by: Lumir Sliva <[email protected]>
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
14 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
cbodley
left a comment
There was a problem hiding this comment.
thanks for the comments, very helpful
regarding functional test coverage, i see that s3-tests uses a check_lifecycle_expiration_header() helper for some test cases, but it doesn't look like any of those use NoncurrentVersionExpiration - so hopefully we won't need to update any tests
| s, s->object->get_key(), s->tagset, mtime, s->bucket_attrs); | ||
| s, s->object_key, s->tagset, mtime, s->bucket_attrs); |
|
pr testing completed and approved by @ivancich, more details : https://tracker.ceph.com/issues/77817. |
thanks! No further testing from me needed. @cbodley Casey can you please merge it 🙏 |
|
ok to test |
What's wrong
x-amz-expirationis supposed to report the current-versionExpirationlifecycle action for an object.s3_expiration_header()instead picked between theExpirationandNoncurrentVersionExpirationrule based on whether the object key had an instance id:const LCExpiration& rule_expiration = (obj_key.instance.empty()) ? expiration : noncur_expiration;Two problems with that:
GET/HEADof the current version (noversionId) looked like a non-current request and got aNoncurrentVersionExpirationrule.x-amz-expirationshouldn't surfaceNoncurrentVersionExpirationat all. It only describes the current-versionExpirationaction.Net effect: a versioned bucket whose only rule is
NoncurrentVersionExpirationreturns a bogusexpiry-date/rule-idon the current object, both on a plain request and aversionIdrequest.Fix
Expirationrule only.s->object_key) instead of the OLH-resolved key, so a plain current-versionGET/HEADisn't misclassified as a versioned request.Open question on x-amz-expiration semantics
Worth flagging for reviewers: with this change, a
GET/HEADthat namesversionId= the current version no longer getsx-amz-expiration, even when a currentExpirationrule applies. AWS does still return the header in that case (the targeted version is current). I chose to suppress it for any explicitversionIdbecause:If matching AWS exactly here matters, the alternative is to plumb an
is_currentflag (resolve OLH, compare the requested instance to the current one) and emit the currentExpirationrule when they match. Happy to go that way if you'd prefer, just didn't want to add per-request I/O without a reason.Testing
unittest_rgw_lccaseExpHdr.S3ExpirationHeaderCurrentVersionOnly: noncurrent-only policy returns no header (plain or versioned); combined policy returns the currentExpirationrule for the current version and nothing for aversionIdrequest.NoncurrentVersionExpirationreturns no header for plainHEAD,versionId=current, andversionId=noncurrent; a bucket with a currentExpirationrule still returns the header onPUTand on a plain currentGET/HEAD.Tracker: https://tracker.ceph.com/issues/77564
Checklist