From: Adam Emerson Date: Thu, 16 Jul 2026 20:52:07 +0000 (-0400) Subject: Merge pull request #67725 from mheler/wip-rgw-transition-recompress X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=423acf868d72263a87345c32925393d613e0e343;p=ceph.git Merge pull request #67725 from mheler/wip-rgw-transition-recompress rgw: compress/decompress objects during lifecycle transitions Reviewed-by: Casey Bodley --- 423acf868d72263a87345c32925393d613e0e343 diff --cc src/rgw/driver/rados/rgw_rados.cc index f1be19a1763,b473096d7bc..d4ee7e126d8 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@@ -5549,15 -5552,14 +5558,19 @@@ int RGWRados::copy_obj_data(RGWObjectCt ldpp_dout(dpp, 0) << "ERROR: failed to read compression info" << dendl; return ret; } - // pass original size if compressed - accounted_size = compressed ? cs_info.orig_size : ofs; + // The bucket index accounted_size must be the object's logical (uncompressed) + // size. When the destination is compressed we take it from the compression info. + // Otherwise `ofs` is the number of RAW bytes read from the source: but if the source + // itself is compressed, the ofs is the *compressed* size, not the logical + // size. So, prefer the source's known logical size. + accounted_size = compressed ? cs_info.orig_size + : (src_accounted_size ? src_accounted_size : ofs); } + if (dp_factory) { + accounted_size = dp_factory->get_accounted_size(accounted_size); + } + const req_context rctx{dpp, y, nullptr}; return aoproc.complete(accounted_size, etag, mtime, set_mtime, attrs, rgw::cksum::no_cksum, delete_at, @@@ -5658,10 -5826,9 +5837,10 @@@ int RGWRados::transition_obj(RGWObjectC olh_epoch, real_time(), nullptr /* petag */, - nullptr, /* dp_factory */ + dp_factory, dpp, y, + 0, /* src_accounted_size: unknown here, keep ofs-based size */ log_op); if (ret < 0) { return ret;