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 recalculate user stats #20853
Conversation
Otherwise we'll call sync stats with an empty argument which results in creation of an empty ".buckets" object Fixes: http://tracker.ceph.com/issues/23322 Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
1551584
to
8dbd974
Compare
Another possibility was adding yet another flag at |
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.
look goods just cosmetics
src/rgw/rgw_rados.h
Outdated
@@ -3613,6 +3613,7 @@ class RGWRados : public AdminSocketHook | |||
int fix_tail_obj_locator(const RGWBucketInfo& bucket_info, rgw_obj_key& key, bool fix, bool *need_fix); | |||
|
|||
int cls_user_get_header(const string& user_id, cls_user_header *header); | |||
int cls_user_clear_header(const string& user_id); |
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.
I prefer cls_user_recalc_stats or cls_user_reset_stats
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.
sorry that was an initial method forgot while refactoring, fixing.
src/rgw/rgw_rados.cc
Outdated
::cls_user_reset_stats(op); | ||
r = ref.ioctx.operate(ref.oid, &op); | ||
|
||
if (r < 0) |
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.
return r will be cleaner
src/rgw/rgw_admin.cc
Outdated
cerr << "ERROR: could not clear user stats: " << cpp_strerror(-ret) << std::endl; | ||
return -ret; | ||
} | ||
sync_stats = true; |
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.
@oritwas I can drop the sync_stats here, so the user can call it with --reset-stats --sync-stats if they need to explicitly sync stats or should we make sure that reset stats are also in sync with what cluster sees
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.
you can drop it as you don't need it because you write the heade with the recalculated stats.
This is an implementation of reset user stats, that recalculates the user stats purely based on the values of bucket entries in user.buckets object. This is helpful in cases when user stats has been improperly set in case of manual resharding etc. Fixes: http://tracker.ceph.com/issues/23335 Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
Adds a method in rgw-rados to reset user stats calling the earlier implemented cls user reset stats. In rgw-admin we add an option called --reset-stats that invokes this method. Fixes: http://tracker.ceph.com/issues/23335 Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
8dbd974
to
0b72dd7
Compare
Changelog:
|
@oritwas do the updates look ok? |
@theanalyst @yuriw This PR is still open, yet its luminous backport [1] was merged? [1] #21393 |
we discussed this at standups yesterday and was given signal to merge |
This series of commits adds an option to radosgw-admin called recalculate-stats
which resets the user head object to stats summed up according to user.bucket
omap entries. We call sync stats after reseting the stats in rgw-admin so that
stats are in sync with the current time.
cls/user: Introducing reset user stats which rewrites the user.buckets header to
the sum of entries and sizes from bucket omap entries