]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_cksum: introduce attribute caching in RadosMultipartUpload
authorDaniel Gryniewicz <dang@redhat.com>
Wed, 26 Jun 2024 14:30:42 +0000 (10:30 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Wed, 3 Jul 2024 18:39:21 +0000 (14:39 -0400)
Allow MultipartUpload::complete() to have previously called
Upload::get_info() without an additional round-trip to fetch
attributes.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h

index b6eab4357d39362fb9301d863766f6db4b0e8bc5..aa63743a24938b9525537a31edda47fdfe7e853d 100644 (file)
@@ -3464,6 +3464,7 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
     return 0;
   }
 
+  /* Handle caching */
   if (rule) {
     if (!placement.empty()) {
       *rule = &placement;
@@ -3476,6 +3477,14 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
     }
   }
 
+  if (attrs) {
+    if (!cached_attrs.empty()) {
+      *attrs = cached_attrs;
+      if (!rule || *rule != nullptr)
+        return 0;
+    }
+  }
+
   /* We need either attributes or placement, so we need a read */
   std::unique_ptr<rgw::sal::Object> meta_obj;
   meta_obj = get_meta_obj();
@@ -3496,11 +3505,13 @@ int RadosMultipartUpload::get_info(const DoutPrefixProvider *dpp, optional_yield
     return ret;
   }
 
+  /* Cache attrs filled in by prepare */
+  cached_attrs = meta_obj->get_attrs();
+
   extract_span_context(meta_obj->get_attrs(), trace_ctx);
 
   if (attrs) {
-    /* Attrs are filled in by prepare */
-    *attrs = meta_obj->get_attrs();
+    *attrs = cached_attrs;
     if (!rule || *rule != nullptr) {
       /* placement was cached; don't actually read */
       return 0;
index 4abc7112c9cb30fc4af91ae625a9304e6b3459a5..6d4465093bcf4883f1cd72d2bae93d7601cc82ff 100644 (file)
@@ -795,6 +795,7 @@ class RadosMultipartUpload : public StoreMultipartUpload {
   rgw_placement_rule placement;
   RGWObjManifest manifest;
   multipart_upload_info upload_information;
+  rgw::sal::Attrs cached_attrs;
 
 public:
   RadosMultipartUpload(RadosStore* _store, Bucket* _bucket, const std::string& oid,