]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fetch_remote_obj() uses uncompressed size for encrypted objects
authorCasey Bodley <cbodley@redhat.com>
Tue, 24 Oct 2023 20:48:06 +0000 (16:48 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 24 Oct 2023 21:00:03 +0000 (17:00 -0400)
use the original size from RGW_ATTR_COMPRESSION as the accounted size in
the bucket index for objects that were transferred in their
encrypted/compressed form

Fixes: https://tracker.ceph.com/issues/63306
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_rados.cc

index b72bf3a856b87b1f1a3e7573ea98860623fb76a8..b935610f9ad5cd59a00869e578dd8722015d544b 100644 (file)
@@ -4293,6 +4293,20 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
     cs_info.blocks = std::move(compressor->get_compression_blocks());
     encode(cs_info, tmp);
     cb.get_attrs()[RGW_ATTR_COMPRESSION] = tmp;
+  } else if (auto c = cb.get_attrs().find(RGW_ATTR_COMPRESSION);
+             c != cb.get_attrs().end()) {
+    // if the object was transferred in its compressed+encrypted form, use its
+    // original uncompressed size
+    try {
+      RGWCompressionInfo info;
+      auto p = c->second.cbegin();
+      decode(info, p);
+      accounted_size = info.orig_size;
+    } catch (const buffer::error&) {
+      ldpp_dout(rctx.dpp, 0) << "ERROR: could not decode compression attr for "
+          "replicated object " << dest_obj << dendl;
+      // decode error isn't fatal, but we might put the wrong size in the index
+    }
   }
 
   if (override_owner) {