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,
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;