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:lc fix expiration time #17824

Merged
merged 2 commits into from Oct 11, 2017
Merged

rgw:lc fix expiration time #17824

merged 2 commits into from Oct 11, 2017

Conversation

shashalu
Copy link
Contributor

1、According to S3, expiration_date must be midnight.
2、Amazon S3 calculates the expiration time by adding the number of days specified in the rule to the object creation time and rounding the resulting time to the next day midnight.
So rgw should using the rounding down midnight time to compare with the object creation time to check obj expiration.

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

@tchaikov tchaikov added the rgw label Sep 20, 2017
@@ -32,7 +32,9 @@ bool LCExpiration_S3::xml_end(const char * el) {
} else {
date = lc_date->get_data();
//We need return xml error according to S3
if (boost::none == ceph::from_iso_8601(date)) {
boost::optional<ceph::real_time> expiration_date = ceph::from_iso_8601(date);
timespec expiration_time = ceph::real_clock::to_timespec(*expiration_date);
Copy link
Contributor

Choose a reason for hiding this comment

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

better off dereferencing boost::optional<> after checking it by comparing it with boost::none.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you mean add expiration_date = boost::none; after comparing?
Why better off dereferncing here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I also want to know why? It is just a local variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

if from_iso_8601() returns boost::none, ceph::real_clock::to_timespec(*expiration_date) will trigger an assertion failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thanks. I'll revise it later.

@shashalu
Copy link
Contributor Author

@dang Could you review it for me, thx.

…nfiguration xml

According to S3, expiration_date must be midnight.

Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
@oritwas
Copy link
Member

oritwas commented Sep 24, 2017

@shashalu , can you open a tracker issue?
Pleaae update the commit message with the issue url

@shashalu
Copy link
Contributor Author

@oritwas Already updated.

@@ -299,8 +299,11 @@ int RGWLC::handle_multipart_expiration(RGWRados::Bucket *target, const map<strin
}

utime_t now = ceph_clock_now();
utime_t base_time = now;
if (cct->_conf->rgw_lc_debug_interval <= 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

All this code can be done once in obj_has_expired(), rather than being done separately all over the place. That's why obj_has_expired() was added in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dang Already updated.

@@ -32,7 +32,12 @@ bool LCExpiration_S3::xml_end(const char * el) {
} else {
date = lc_date->get_data();
//We need return xml error according to S3
if (boost::none == ceph::from_iso_8601(date)) {
boost::optional<ceph::real_time> expiration_date = ceph::from_iso_8601(date);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ambivalent about this. Just because Amazon limits the time to midnight doesn't mean we should, necessarily. I'd prefer to truncate the time to midnight, if necessary, rather than throw an error. I can be convinced otherwise, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, I'd prefer to keep the same with s3.

@shashalu shashalu force-pushed the fix-lc-expiration branch 3 times, most recently from 0c57b20 to 552379c Compare September 30, 2017 09:21
Amazon S3 calculates the expiration time by adding the number of days specified in the rule to the object creation time and rounding the resulting time to the next day midnight.
So rgw should using the rounding down midnight time to compare with the object creation time to check obj expiration.

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

Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
@yuriw
Copy link
Contributor

yuriw commented Oct 9, 2017

@yuriw
Copy link
Contributor

yuriw commented Oct 10, 2017

@yuriw yuriw merged commit 9494a69 into ceph:master Oct 11, 2017
@shashalu shashalu deleted the fix-lc-expiration branch October 12, 2017 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants