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: fix lc process only schdule the first item of lc objects #17061

Merged
merged 1 commit into from Sep 13, 2017

Conversation

shashalu
Copy link
Contributor

If more than two bucket hash to the same lc object, only the first bucket will do lifecycle operation. Other buckets lifecycle will never be schduled.

Fixes: http://tracker.ceph.com/issues/21022

Signed-off-by: Shasha Lu lu.shasha@eisoo.com

If more than two bucket hash to the same lc object, only the first bucket will do lifecycle operation. Other buckets lifecycle will never be schduled.

Fixes: http://tracker.ceph.com/issues/21022

Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
@@ -195,8 +195,10 @@ bool RGWLC::if_already_run_today(time_t& start_date)
localtime_r(&start_date, &bdt);

if (cct->_conf->rgw_lc_debug_interval > 0) {
/* We're debugging, so say we can run */
return false;
if (now - start_date < cct->_conf->rgw_lc_debug_interval)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if you want to make "lc process" process all items of lc objects multi-times a day, you can modify this configuration item from "rgw_lc_debug_interval" to "rgw_lc_process_interval". How do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

It means this function is not just a debug function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think debug is more proper. If you set ExipationDays = 1, it means those objects will expire a day later. By setting rgw_lc_debug_interval, the objects will expire 1*rgw_lc_debug_interval. It just for debug.

Here just to make sure in a debug_interval bucket_lc_prepare only do once.

@shashalu
Copy link
Contributor Author

@cbodley Could you review this for me? Thanks

@cbodley
Copy link
Contributor

cbodley commented Aug 21, 2017

@shashalu i wasn't familiar with this code, but your changes are making sense to me. can you recommend a way to test this? will the lifecycle expiration s3tests hit this bug if you set rgw_lc_max_objs = 1?

@shashalu
Copy link
Contributor Author

@cbodley I haven't run s3tests yet. But if set rgw_lc_max_objs = 1, put lifecycle configuration for more than 2 buckets, only one bucket can do expiration expectantly.

@theanalyst
Copy link
Member

works for me, can be tested with a script like this:

#!/bin/bash
# assumes gnu parallel is installed, use a for loop otherwise we have a default
# lc num objects as 32, just create one more so that we have a guaranteed case
# of lc objects with multiple omap entries, assumes 10s as expiry interval
parallel s3cmd mb s3://bucket{} ::: {1..33}
touch foo
parallel s3cmd put foo s3://bucket{} ::: {1..33}
parallel s3cmd expire s3://bucket{} --expiry-days 1 --expiry-prefix foo ::: {1..33}
sleep 30
for i in {1..33}; do s3cmd ls s3://bucket$i; done

@cbodley
Copy link
Contributor

cbodley commented Sep 11, 2017

@theanalyst thanks for the help testing!

@theanalyst
Copy link
Member

will need a luminous backport as well

@yuriw yuriw merged commit 06b8556 into ceph:master Sep 13, 2017
@shashalu shashalu deleted the fix-rgw-lc branch September 14, 2017 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants