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
RGW: support for tagging in lifecycle policies #17305
Conversation
int ret = store->get_obj_state(&rctx, bucket_info, obj, &state, false); | ||
if (ret < 0) { | ||
return ret; | ||
} | ||
if (state->mtime != obj_iter->meta.mtime)//Check mtime again to avoid delete a recently update object as much as possible | ||
if (state->mtime != obj_iter->meta.mtime) { |
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.
Currently this seems to be valid if an object is modified via say a put_object_tagging operation, in which case the mtime from state is older than the one in bucket index. And this will end up with a case of the object never getting deleted
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.
For eg:
skipping removal: state->mtime 2017-08-28 16:17:44.0.565582s obj->mtime 2017-08-28 16:17:44.0.574707s
will look into this
created #17400 for the mtime mismatch |
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.
This looks good. When you feel the mtime issue is fixed, remove the DNM.
Useful when populating tags from XML, empty() is useful to determine the existence of tags Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
- rgw_lc_s3: + LCFilter class now has an obj_tags member which shall store the object tags, the related methods like empty() is updated to account for object tags as well + LCFilter_S3: parsing now accounts for the <And> xml tag which specifies if multiple conditions are allowed, since we parse tags as an iterator, we keep a count of the tags and actually validate that the And tag was supplied if we see multiple tags. - rgw_lc: add support for tagging + lc_op has obj_tags implemented as a boost::optional, which gets populated only when rule has tags + we use std::includes to compare that all the tags in policy are a part of the object. We only read object tags if tags are a part of the LC rule - rgw_lc: have consistent log message styles when using __func__ Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
61c77cd
to
d3100dd
Compare
changelog: changed from return to continue if read_obj_tags fails, as this would fail with an ENODATA if there are no tags, either way if the reading xattr failed when the supplied LC policy has a tagging conditional, it would make sense to continue processing the other objects. |
@dang added s3 tests, removed the DNM label, can you take a look again |
@dang ran rgw suite on this pr with |
LGTM |
This PR adds support for tagging in object lifecycle policies, if a lifecycle policy has a tag attribute, then while processing objects in the bucket we additionally retrieve the objects tags to check whether all the tags in LC policy are contained in the object's tags.