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

RGW: support for tagging in lifecycle policies #17305

Merged
merged 3 commits into from Oct 23, 2017

Conversation

theanalyst
Copy link
Member

@theanalyst theanalyst commented Aug 28, 2017

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.

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) {
Copy link
Member Author

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

Copy link
Member Author

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

@theanalyst
Copy link
Member Author

created #17400 for the mtime mismatch

Copy link
Contributor

@dang dang left a 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>
@theanalyst
Copy link
Member Author

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.

@theanalyst theanalyst removed the DNM label Sep 20, 2017
@theanalyst theanalyst changed the title DNM: RGW: support for tagging in lifecycle policies RGW: support for tagging in lifecycle policies Sep 20, 2017
@theanalyst
Copy link
Member Author

@dang added s3 tests, removed the DNM label, can you take a look again

@theanalyst
Copy link
Member Author

@dang ran rgw suite on this pr with
http://pulpito.ceph.com/abhi-2017-10-12_13:15:36-rgw-wip-rgw-lc-tagging-distro-basic-smithi/ & rerun of failures
with http://pulpito.ceph.com/abhi-2017-10-13_14:29:33-rgw-wip-rgw-lc-tagging-distro-basic-smithi/ the tests are green except for one failure seen in LC delete marker expiration in the first run which is a timing based test. (passed on rerun) the other valgrind and multisite failures seem to be knon failures, is this good to go?

@dang
Copy link
Contributor

dang commented Oct 23, 2017

LGTM

@yuriw
Copy link
Contributor

yuriw commented Oct 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants