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
Conversation
src/cls/rgw/cls_rgw.cc
Outdated
int rgw_usage_log_clear(cls_method_context_t hctx, bufferlist *in, bufferlist *out) | ||
{ | ||
CLS_LOG(10,"%s", __func__); | ||
/* only continue if object exists! */ |
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.
why is this stat needed? will map_clear not do the right thing if the object doesn't exist?
src/test/cls_rgw/test_cls_rgw.cc
Outdated
ASSERT_EQ(0, ret); | ||
ASSERT_EQ(0, usage2.size()); | ||
|
||
} |
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.
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>
1e95a17
to
d1a2235
Compare
@cbodley rebased and added new tests |
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