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: add an option to clear all usage entries #19322

Merged
merged 3 commits into from Feb 15, 2018

Conversation

theanalyst
Copy link
Member

This is built atop of #19131 (though
not dependant exactly, tests will be similar so will be rebased once
that is merged), adding an option to clear all the usage logs by using
the omap clear cls api, which would be faster for clearing usage log
entries of all users, we can't yet do this on a single user because
multiple users may map to a single oid. Adds a radosgw-admin cli command
called usage clear and implements these in the cls_rgw and rados layer

int rgw_usage_log_clear(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
CLS_LOG(10,"%s", __func__);
/* only continue if object exists! */
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this stat needed? will map_clear not do the right thing if the object doesn't exist?

ASSERT_EQ(0, ret);
ASSERT_EQ(0, usage2.size());

}
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please add some coverage for usage_log_clear() as well? it sounds like both the exist and noexist cases are interesting

This calls the omap clear api to clear all omap entries on an object
which is useful if we ever want to fully reset the usage logs, also in
case if the object doesn't exist we return immediately since in that
case there are no omap entries on the object

Added tests for cases when there is no object (which should return 0 as
EINVAL is reraised) and when an object has over 2k entries

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Calling the cls_rgw_usage_log_clear() which in turn calls an omap clear
to clear all the omap entries on an oid

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Add an option that can clear all the usage stats recorded so far, this
is more efficient than calling usage trim, since there we still have to
loop against individual keys and check whether they match our stats.
This is useful in use cases where usage data is already externally
backed up in some sort of time series data base in which case

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
@theanalyst
Copy link
Member Author

@cbodley rebased and added new tests

@yuriw
Copy link
Contributor

yuriw commented Feb 14, 2018

@yuriw yuriw merged commit bd26668 into ceph:master Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants