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

cls/rgw: fix the bug when trim usage by specifying user #38123

Closed
wants to merge 0 commits into from
Closed

cls/rgw: fix the bug when trim usage by specifying user #38123

wants to merge 0 commits into from

Conversation

lcwlovefamily
Copy link

@lcwlovefamily lcwlovefamily commented Nov 17, 2020

when trim usage by specifying user, it is possible to trim other users’ usage.

Fixes:https://tracker.ceph.com/issues/48208

Signed-off-by: chengwu liang liangchengw@chinatelecom.cn
New PR from #38035

@batrick batrick added the rgw label Nov 17, 2020
@tchaikov tchaikov changed the title master/rgw/usage:fix the bug when trim usage by specifying user cls/rgw: fix the bug when trim usage by specifying user Nov 18, 2020
@lcwlovefamily
Copy link
Author

lcwlovefamily commented Nov 20, 2020

@batrick @tchaikov @jdurgin

@stale
Copy link

stale bot commented Jul 21, 2021

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale bot added the stale label Jul 21, 2021
@stale stale bot removed the stale label Aug 25, 2021
@lcwlovefamily
Copy link
Author

@batrick @tchaikov @jdurgin

}

rgw_user* puser = (e.payer.empty() ? &e.owner : &e.payer); // copy from rgw_user_usage_log_add
if (by_user && user_key != puser->to_str()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this stopping the iteration--and returning a value for the current iterator position--when the users do not match?

Copy link
Author

Choose a reason for hiding this comment

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

yes it is,but no worry. when i search testuser's usage i will have plenty omap keys like testuser_0XXX and testuser__0XXX,becauser digital is less than letter '_',so the correct user's usage is always in the first half;when i search the usage of testuser__ i only get omap keys like testuser__0XXX without omap key like testuser_0XXX.i didnt change the return logic here which assume that the correct answer is always in the first half.

@@ -3170,13 +3170,13 @@ static int usage_iterate_range(cls_method_context_t hctx, uint64_t start, uint64
return 0;
}

ret = usage_record_decode(iter->second, e);
ret = usage_record_decode(iter->second, e);
Copy link
Contributor

Choose a reason for hiding this comment

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

this ws change is unecessary

Copy link
Author

Choose a reason for hiding this comment

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

ignore this, forgot to delete it

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale bot added the stale label Jan 9, 2022
@stale stale bot removed the stale label Feb 16, 2022
@lcwlovefamily lcwlovefamily deleted the pr-branch-for-ceph branch February 16, 2022 05:51
@lcwlovefamily lcwlovefamily restored the pr-branch-for-ceph branch February 16, 2022 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants