-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
rgwlc: permit lifecycle to reduce data conditionally in archive zone #46928
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
23a588d
rgwlc: introduce lifecycle config flags extension
mattbenjamin dde64c3
rgwlc: represent lc filter flags as XML elements
mattbenjamin 98c598b
rgwlc: zone-conditional lifecycle processing
mattbenjamin 2ee2266
rgwlc: activate lifecycle processing on non-master zones
mattbenjamin 313a8a4
rgwlc: update LCFilter::dump_xml(...) to add flags/ArchiveZone
mattbenjamin 92657be
rgwlc: return real default zone type from sal_dbstore and sal_motr
mattbenjamin f9928dd
rgwlc: count LCFilter flags towards multi-condition
mattbenjamin ff10064
rgwlc: return std::string_view from sal::Zone::get_tier_type()
mattbenjamin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2139,7 +2139,10 @@ class RGWBucketInstanceMetadataHandler : public RGWBucketInstanceMetadataHandler | |
RGWSI_BucketIndex *bi{nullptr}; | ||
} svc; | ||
|
||
RGWBucketInstanceMetadataHandler() {} | ||
rgw::sal::Store* store; | ||
|
||
RGWBucketInstanceMetadataHandler(rgw::sal::Store* store) | ||
: store(store) {} | ||
|
||
void init(RGWSI_Zone *zone_svc, | ||
RGWSI_Bucket *bucket_svc, | ||
|
@@ -2371,12 +2374,51 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp | |
return ret; | ||
} | ||
|
||
/* update lifecyle policy */ | ||
{ | ||
std::unique_ptr<rgw::sal::Bucket> bucket; | ||
ret = bihandler->store->get_bucket(nullptr, bci.info, &bucket); | ||
if (ret < 0) { | ||
ldpp_dout(dpp, 0) << __func__ << " failed to get_bucket(...) for " | ||
<< bci.info.bucket.name | ||
<< dendl; | ||
return ret; | ||
} | ||
|
||
auto lc = bihandler->store->get_rgwlc(); | ||
|
||
auto lc_it = bci.attrs.find(RGW_ATTR_LC); | ||
if (lc_it != bci.attrs.end()) { | ||
ldpp_dout(dpp, 20) << "set lc config for " << bci.info.bucket.name << dendl; | ||
ret = lc->set_bucket_config(bucket.get(), bci.attrs, nullptr); | ||
if (ret < 0) { | ||
ldpp_dout(dpp, 0) << __func__ << " failed to set lc config for " | ||
<< bci.info.bucket.name | ||
<< dendl; | ||
return ret; | ||
} | ||
|
||
} else { | ||
ldpp_dout(dpp, 20) << "remove lc config for " << bci.info.bucket.name << dendl; | ||
ret = lc->remove_bucket_config(bucket.get(), bci.attrs); | ||
if (ret < 0) { | ||
ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for " | ||
<< bci.info.bucket.name | ||
<< dendl; | ||
return ret; | ||
Comment on lines
+2394
to
+2408
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this error path seems to be causing the regression in metadata sync. i've opened https://tracker.ceph.com/issues/56997 with what we've learned so far cc @yuvalif |
||
} | ||
} | ||
} /* update lc */ | ||
|
||
return STATUS_APPLIED; | ||
} | ||
|
||
class RGWArchiveBucketInstanceMetadataHandler : public RGWBucketInstanceMetadataHandler { | ||
public: | ||
RGWArchiveBucketInstanceMetadataHandler() {} | ||
RGWArchiveBucketInstanceMetadataHandler(rgw::sal::Store* store) | ||
: RGWBucketInstanceMetadataHandler(store) {} | ||
|
||
// N.B. replication of lifecycle policy relies on logic in RGWBucketInstanceMetadataHandler::do_put(...), override with caution | ||
|
||
int do_remove(RGWSI_MetaBackend_Handler::Op *op, string& entry, RGWObjVersionTracker& objv_tracker, optional_yield y, const DoutPrefixProvider *dpp) override { | ||
ldpp_dout(dpp, 0) << "SKIP: bucket instance removal is not allowed on archive zone: bucket.instance:" << entry << dendl; | ||
|
@@ -3027,24 +3069,24 @@ int RGWBucketCtl::bucket_imports_data(const rgw_bucket& bucket, | |
return handler->bucket_imports_data(); | ||
} | ||
|
||
RGWBucketMetadataHandlerBase *RGWBucketMetaHandlerAllocator::alloc() | ||
RGWBucketMetadataHandlerBase* RGWBucketMetaHandlerAllocator::alloc() | ||
{ | ||
return new RGWBucketMetadataHandler(); | ||
} | ||
|
||
RGWBucketInstanceMetadataHandlerBase *RGWBucketInstanceMetaHandlerAllocator::alloc() | ||
RGWBucketInstanceMetadataHandlerBase* RGWBucketInstanceMetaHandlerAllocator::alloc(rgw::sal::Store* store) | ||
{ | ||
return new RGWBucketInstanceMetadataHandler(); | ||
return new RGWBucketInstanceMetadataHandler(store); | ||
} | ||
|
||
RGWBucketMetadataHandlerBase *RGWArchiveBucketMetaHandlerAllocator::alloc() | ||
RGWBucketMetadataHandlerBase* RGWArchiveBucketMetaHandlerAllocator::alloc() | ||
{ | ||
return new RGWArchiveBucketMetadataHandler(); | ||
} | ||
|
||
RGWBucketInstanceMetadataHandlerBase *RGWArchiveBucketInstanceMetaHandlerAllocator::alloc() | ||
RGWBucketInstanceMetadataHandlerBase* RGWArchiveBucketInstanceMetaHandlerAllocator::alloc(rgw::sal::Store* store) | ||
{ | ||
return new RGWArchiveBucketInstanceMetadataHandler(); | ||
return new RGWArchiveBucketInstanceMetadataHandler(store); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
IIUC, this will copy lc_config to all the zones but not just archive_zone. Is it intentional? i.e, can every zone now execute LC rules (provided archivezone filter not applied)
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.
this has been a long-standing issue, tracked in https://tracker.ceph.com/issues/44268 and https://tracker.ceph.com/issues/55487
the current model, where only the primary zone runs lifecycle processing, works okay for the 'normal' disaster recovery use case where the primary and secondary zones have the same set of data. any expirations/transitions that happen on the primary would sync to the secondary, so we should get the same result as if we'd run lifecycle processing on both zones
however, with per-bucket replication in the picture, zones may not have the same data sets. for example, a bucket replication policy may specify that only a subset of objects (like those beginning with prefix 'foo') should replicate from the secondary zone to the primary. lifecycle processing on the primary zone would only run on that subset of objects and skip the rest. so in this case, we really do need to run lifecycle processing on every zone to get the expected result
had we fixed this issue earlier, we would have broken the archive zone feature because lifecycle could delete the archived object versions. so we're fixing both at the same time :)
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.
yes, that's a better answer than what I had in mind, as for full sync, it's probably not even as efficient to run lc everywhere--but still feels more correct for symmetry. but per-bucket replication does change things.
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.
okay..thanks for confirming.