Skip to content

Commit 77f6997

Browse files
dangmattbenjamin
authored andcommitted
rgw_cksum: introduce attribute caching in RadosMultipartUpload
Allow MultipartUpload::complete() to have previously called Upload::get_info() without an additional round-trip to fetch attributes. Signed-off-by: Matt Benjamin <[email protected]>
1 parent dc46e27 commit 77f6997

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,6 +3464,7 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
34643464
return 0;
34653465
}
34663466

3467+
/* Handle caching */
34673468
if (rule) {
34683469
if (!placement.empty()) {
34693470
*rule = &placement;
@@ -3476,6 +3477,14 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
34763477
}
34773478
}
34783479

3480+
if (attrs) {
3481+
if (!cached_attrs.empty()) {
3482+
*attrs = cached_attrs;
3483+
if (!rule || *rule != nullptr)
3484+
return 0;
3485+
}
3486+
}
3487+
34793488
/* We need either attributes or placement, so we need a read */
34803489
std::unique_ptr<rgw::sal::Object> meta_obj;
34813490
meta_obj = get_meta_obj();
@@ -3496,11 +3505,13 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
34963505
return ret;
34973506
}
34983507

3508+
/* Cache attrs filled in by prepare */
3509+
cached_attrs = meta_obj->get_attrs();
3510+
34993511
extract_span_context(meta_obj->get_attrs(), trace_ctx);
35003512

35013513
if (attrs) {
3502-
/* Attrs are filled in by prepare */
3503-
*attrs = meta_obj->get_attrs();
3514+
*attrs = cached_attrs;
35043515
if (!rule || *rule != nullptr) {
35053516
/* placement was cached; don't actually read */
35063517
return 0;

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ class RadosMultipartUpload : public StoreMultipartUpload {
795795
rgw_placement_rule placement;
796796
RGWObjManifest manifest;
797797
multipart_upload_info upload_information;
798+
rgw::sal::Attrs cached_attrs;
798799

799800
public:
800801
RadosMultipartUpload(RadosStore* _store, Bucket* _bucket, const std::string& oid,

0 commit comments

Comments
 (0)