Skip to content

rgw: compress/decompress objects during lifecycle transitions - #67725

Merged
adamemerson merged 4 commits into
ceph:mainfrom
mheler:wip-rgw-transition-recompress
Jul 16, 2026
Merged

adamemerson merged 4 commits into
ceph:mainfrom
mheler:wip-rgw-transition-recompress

Conversation

@mheler

@mheler mheler commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Lifecycle transitions raw-copy object data, ignoring compression settings on the destination storage class. This adds decompression/recompression support to transition_obj() so objects get the right compression when they move between classes.

Fixes: https://tracker.ceph.com/issues/75411

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@mheler
mheler requested a review from a team as a code owner March 9, 2026 17:07
@github-actions github-actions Bot added the rgw label Mar 9, 2026

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great so far 👍 we'll want to validate with test coverage

Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@cbodley
cbodley requested a review from clwluvw March 9, 2026 19:12
@clwluvw

clwluvw commented Mar 9, 2026

Copy link
Copy Markdown
Member

It seems that we overlooked the validation of the compression algorithm in our S3 tests, as there are no signs of compression in the header responses. This means that an S3 client cannot detect it, and the RGW will decompress it if the RGW_ATTR_COMPRESSION attribute is present, which was indeed the case as it was preserved.

I suggest that we expose a header whenever the configuration allows this so that we can utilize it in our test suite.

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch from 58ec2d0 to d8d4167 Compare March 9, 2026 19:53
@cbodley

cbodley commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

I suggest that we expose a header whenever the configuration allows this so that we can utilize it in our test suite.

@clwluvw i agree that we want test coverage, but compression is transparent to s3 clients. our s3-tests should ideally only test s3-compatible behavior and not rely on rgw-specific extensions. instead of writing tests against non-s3 response headers, maybe we could write a separate workunit script that can inspect internal object metadata with commands like 'radosgw-admin object stat'

@mheler
mheler requested a review from cbodley March 9, 2026 20:44
@mheler
mheler force-pushed the wip-rgw-transition-recompress branch from d8d4167 to 729f5cd Compare March 12, 2026 12:31
@github-actions github-actions Bot added the tests label Mar 12, 2026
@mheler

mheler commented Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

I suggest that we expose a header whenever the configuration allows this so that we can utilize it in our test suite.

@clwluvw i agree that we want test coverage, but compression is transparent to s3 clients. our s3-tests should ideally only test s3-compatible behavior and not rely on rgw-specific extensions. instead of writing tests against non-s3 response headers, maybe we could write a separate workunit script that can inspect internal object metadata with commands like 'radosgw-admin object stat'

There is an included qa test suite, please feel free to review it. It covers the required validation, and was used by myself and Clyso when testing this commit.

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch 3 times, most recently from 5becdb8 to 1e19f00 Compare March 14, 2026 11:19
@mheler

mheler commented Mar 14, 2026

Copy link
Copy Markdown
Contributor Author

Internally the QA tests passed for rgw/verify and rgw/lifecycle. Please let me know if there are any further review concerns.

@mheler
mheler requested a review from dvanders March 14, 2026 11:23
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
@mheler
mheler requested a review from soumyakoduri March 16, 2026 15:01
@bstillwell

Copy link
Copy Markdown

I tested some containers that Matt built for this and it works in my testing.

@cbodley

cbodley commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

adding pending-discussion after weekly rgw meeting, i think the plan is to handle re-encryption here too

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch from bf3c58e to 97710e5 Compare April 2, 2026 02:21
@mheler

mheler commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

adding pending-discussion after weekly rgw meeting, i think the plan is to handle re-encryption here too

I pushed an update to include that now. Please review when you can @cbodley

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch 2 times, most recently from e95fb9f to df4ff2f Compare April 2, 2026 02:48
@mheler

mheler commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

If RGW_ATTR_SHARE_MANIFEST attribute is set on the object it means it is a SRC object for dedup and changing its attributes going to affect other objects. If you simply delete tail-objects and create new ones it is fine by me (as the ref-count will protect dedup). The problem I need to prevent is when a BG-process overwrite existing tail-objects using different compression/encryption scheme.
The server-side compressed object deduplication PR is #68965.
You should be able to merge it with no conflict

This PR doesn't overwrite existing shared tails. It writes into new tails and lets refcounted GC release the old layout. However it looks like I need to strip RGW_ATTR_SHARE_MANIFEST during transition.

@benhanokh please take a look at d467c5d

@benhanokh

Copy link
Copy Markdown
Contributor

If RGW_ATTR_SHARE_MANIFEST attribute is set on the object it means it is a SRC object for dedup and changing its attributes going to affect other objects. If you simply delete tail-objects and create new ones it is fine by me (as the ref-count will protect dedup). The problem I need to prevent is when a BG-process overwrite existing tail-objects using different compression/encryption scheme.
The server-side compressed object deduplication PR is #68965.
You should be able to merge it with no conflict

This PR doesn't overwrite existing shared tails. It writes into new tails and lets refcounted GC release the old layout. However it looks like I need to strip RGW_ATTR_SHARE_MANIFEST during transition.

@benhanokh please take a look at d467c5d

The change looks good.
There is another attribute associated with dedup - RGW_ATTR_BLAKE3 where we store a strong-hash calculated for the object; If the data is logically the same the attribute can be carried over, but if you need to clear ETAG then RGW_ATTR_BLAKE3 should be cleared as well

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch from d467c5d to 99834ef Compare June 15, 2026 11:43
@mheler

mheler commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

If RGW_ATTR_SHARE_MANIFEST attribute is set on the object it means it is a SRC object for dedup and changing its attributes going to affect other objects. If you simply delete tail-objects and create new ones it is fine by me (as the ref-count will protect dedup). The problem I need to prevent is when a BG-process overwrite existing tail-objects using different compression/encryption scheme.
The server-side compressed object deduplication PR is #68965.
You should be able to merge it with no conflict

This PR doesn't overwrite existing shared tails. It writes into new tails and lets refcounted GC release the old layout. However it looks like I need to strip RGW_ATTR_SHARE_MANIFEST during transition.

@benhanokh please take a look at d467c5d

The change looks good. There is another attribute associated with dedup - RGW_ATTR_BLAKE3 where we store a strong-hash calculated for the object; If the data is logically the same the attribute can be carried over, but if you need to clear ETAG then RGW_ATTR_BLAKE3 should be cleared as well

@benhanokh would you mind taking a look at 99834ef that should cover the two attributes.

@mheler
mheler force-pushed the wip-rgw-transition-recompress branch 2 times, most recently from f4e08c2 to b6bafc2 Compare June 22, 2026 15:09
@anrao19

anrao19 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

jenkins test api

@anrao19

anrao19 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@anrao19

anrao19 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@ivancich ivancich removed the needs-qa label Jun 30, 2026
@ivancich

Copy link
Copy Markdown
Member

@cbodley

cbodley commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

in teuthology.log i see a segfault in radosgw-admin lc process --bucket=lc-recompress-bucket --rgw-lc-debug-interval=10

*** Caught signal (Segmentation fault) **
 in thread 7e7f01b70cc0 thread_name:radosgw-admin
 ceph version 21.3.0-342-g1fd5a2d4 (1fd5a2d4e352ee15a4c4aaa6c84ce46ed0f5493f) umbrella (dev - None)
 1: /lib/x86_64-linux-gnu/libc.so.6(+0x45330) [0x7e7f01c45330]
 2: (ceph::common::PerfCounters::tinc(int, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >)+0x4) [0x7e7f02d667a4]
 3: radosgw-admin(+0xaa08e4) [0x64501767e8e4]
 4: (reconstitute_actual_key_from_kms(DoutPrefixProvider const*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::buffer::v15_2_0::list, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, ceph::buffer::v15_2_0::list> > >&, rgw::kms::KMSCache*, optional_yield, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)+0x3e4) [0x645017685624]
 5: (rgw_prepare_decrypt_object(DoutPrefixProvider const*, ceph::common::CephContext*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::buffer::v15_2_0::list, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, ceph::buffer::v15_2_0::list> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, optional_yield, std::unique_ptr<BlockCrypt, std::default_delete<BlockCrypt> >*)+0x9f2) [0x645017622362]
 6: (RGWRados::transition_obj(RGWObjectCtx&, RGWBucketInfo&, rgw_obj, rgw_placement_rule const&, std::chrono::time_point<ceph::real_clock, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> > > const&, unsigned long, DoutPrefixProvider const*, optional_yield, bool)+0xc5f) [0x64501790abcf]
 7: (rgw::sal::RadosObject::transition(rgw::sal::Bucket*, rgw_placement_rule const&, std::chrono::time_point<ceph::real_clock, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> > > const&, unsigned long, DoutPrefixProvider const*, optional_yield, unsigned int)+0xcc) [0x6450179720dc]
 8: radosgw-admin(+0x85bb28) [0x645017439b28]
 9: radosgw-admin(+0x85cc81) [0x64501743ac81]
 10: (LCOpRule::execute(LCOpAction&, rgw_bucket_dir_entry&, DoutPrefixProvider const*, LCBatchCounters*, RGWObjTags const*, bool, optional_yield)+0xc2) [0x64501743b202]
 11: radosgw-admin(+0x882000) [0x645017460000]
 12: radosgw-admin(+0x8823e5) [0x6450174603e5]
 13: radosgw-admin(+0x1a6bbd7) [0x645018649bd7]
2026-06-25T06:16:27.861+0000 7e7f01b70cc0 -1 *** Caught signal (Segmentation fault) **

@mheler

mheler commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

I am looking into this. The recent KMS cache changes when merged into this branch have an outstanding issue with a null reference / perf counter being called by radosgw-admin

mheler added 4 commits June 30, 2026 10:21
…ions

Extract the decrypt/decompress/recompress/re-encrypt filter pipeline
into a shared RGWRecompressDPF base class. RGWTransitionDPF is added
for lifecycle transitions and RGWCopyObjDPF is rewritten on top of
the same base, both as thin subclasses providing key retrieval and
compression config.

Add rgw_prepare_decrypt_object() for decrypting from stored attrs
without an HTTP request context (handles SSE-KMS/-GCM, SSE-S3/-GCM,
RGW-AUTO/-GCM), and rgw_prepare_reencrypt_object() which regenerates
the GCM salt before re-deriving the per-object key — avoids AEAD
nonce reuse when LC re-encrypts modified plaintext.

Includes a QA workunit that drives transitions through three
storage classes with different compression configs and verifies
data integrity, including with SSE-KMS encrypted objects.

Signed-off-by: Matthew N. Heler <[email protected]>
Without a facet marker, teuthology concatenated all three yamls into
one job, running plain, CBC, and GCM workunits back-to-back under
whichever rgw override won.

Signed-off-by: Matthew N. Heler <[email protected]>
Do not carry RGW_ATTR_SHARE_MANIFEST or RGW_ATTR_BLAKE3 when object data
or manifest ownership is rewritten through admin rewrite, remote fetch,
CopyObject, or lifecycle transition.

Both attributes describe RGW dedup state for an existing RADOS layout:
the shared-manifest marker and the blake3 digest of the object's on-disk
bytes. Once a path writes a new layout or creates a new destination head
with its own refcount tag, preserving them leaves stale dedup on the
destination.

Signed-off-by: Matthew N. Heler <[email protected]>
Guard the KMS key fetch so we only touch perfcounter when it exists.
The fetch latency PerfGuard now sits in an optional and the error
counters are wrapped in an if, so both are skipped when perfcounter
is null.

This keeps key reconstitution working from radosgw-admin (like lc
process), where the perfcounter global isn't set up the way it is
inside radosgw.

Signed-off-by: Matthew N. Heler <[email protected]>
@mheler
mheler force-pushed the wip-rgw-transition-recompress branch from b6bafc2 to 84d7550 Compare June 30, 2026 23:33
@adamemerson
adamemerson merged commit 423acf8 into ceph:main Jul 16, 2026
6 checks passed
@anrao19

anrao19 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants