Repository navigation
rgw/dedup: support server-side compressed object deduplication - #68965
Conversation
Config Diff Tool Output+ added: rgw_dedup_skip_compressed (rgw.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
/config check ok |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
f2c033d to
98775e3
Compare
98775e3 to
921f43e
Compare
921f43e to
dc2db25
Compare
e358f00 to
8d857c3
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
8d857c3 to
b40fd15
Compare
|
@anthonyeleven, I merged your PR (#70138). |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
There was a problem hiding this comment.
I believe this work is of high quality, I did not spot discrete fixable issues. My primary observation is that while dedup process/workflow are described in some detail, I didn't have a super clear picture of the evolving deduplication serialized state--how it's structured, &c, and if that's not already described in the prior PR, we should maybe add something to help developers get a feel for what i/o work dedup broadly does (beyond computing checksums and remote stats, which I think is very clear).
|
|
||
| - Increment the reference count on the source tail objects one by one. | ||
| - Copy the manifest from the source to the target. | ||
| - Mirror the compression attribute (``RGW_ATTR_COMPRESSION``) from source to |
| // write-path computes it (see RGWRados::Object::Write::_do_write_meta): | ||
| // compressed -> RGWCompressionInfo::orig_size (stable, not patched) | ||
| // uncompressed -> physical object size | ||
| // We cannot use p_obj->get_accounted_size() because the stat path patches |
There was a problem hiding this comment.
should this be normalized in the api too?
There was a problem hiding this comment.
the function name and comment do what they can, but e.g. the function signature is almost magically generic
| // Set RGW_ATTR_COMPRESSION on TGT unconditionally from SRC state. | ||
| // TGT now shares SRC's tail objects so its compression state must match. | ||
| bool src_compressed = (p_src_rec->compression_bl.length() > 0); | ||
| bool tgt_compressed = (p_tgt_rec->compression_bl.length() > 0); |
There was a problem hiding this comment.
it looks like at l. 1125 the values might not match? i.e., if they don't you're going to coerce them to
| if (!p_pre_calc_hmac) { | ||
| blake3_hasher_init(&_hmac); | ||
| p_hmac = &_hmac; | ||
| if (p_rec->compression_bl.length() > 0) { |
There was a problem hiding this comment.
what does this actually mean? apparently p_rec could point to something not compressed, but it would still have a compression_bl of non-zero length?
| // | ||
| // Always fetched: | ||
| // RGW_ATTR_MANIFEST -- required; returns -ENOENT if missing. | ||
| // RGW_ATTR_BLAKE3 -- if present, populates p_rec->s.hash and sets |
There was a problem hiding this comment.
this duplicates an S3 additional checksum of type Blake3--an RGW extension, but AWS just added a bunch of new types, including 2 kinds of XXHash and SHA-512 (which we already supported). The additional checksum is a serialized structure and stored as RGW_ATTR_CKSUM.
I think in a future change we should define a pattern for storing multiple checksums, and computing them once.
| const std::string &instance, | ||
| uint64_t obj_size, | ||
| const std::string &storage_class); | ||
| const std::string &storage_class, |
There was a problem hiding this comment.
I really wish you and jesse could agree (whith Bjarne Stroustrup), that in C++, the correct notation for pointers and references is:
T& ref;
T* ptr;
- make them consistent--C programmers carry over T *ptr, but the resulting /type/ is "pointer to T"
- most people including Jesse have been typing "T& ref" but now it's inconsistent with the pointer type.
There was a problem hiding this comment.
Our clang_format uses T* p and T& r, so it's ideally what everyone should be doing.
There was a problem hiding this comment.
Too late for this code; there are 1000's instances of this style in my code.
I can try and confirm to this style, but changing it now means creating a diff covering the full dedup code :-(
| encode(w.ingress_skip_filtered_bucket, bl); | ||
| encode(w.ingress_skip_filtered_storage_class, bl); | ||
|
|
||
| encode(w.max_bidx_record_length, bl); |
There was a problem hiding this comment.
just randomly, does the original PR contain a doc that describes the structure of the dedup schema objects--the dedup table, and so on? I assume so, but this is a large and complex artifact.
There was a problem hiding this comment.
do you mean a proper design doc?
https://docs.google.com/document/d/152VyCTR2NlZ6ongbe6-CJfP4qxr1_zH83FB_WukWD7c/edit?tab=t.0
I need to update this when I find the time , but it gives a good overview of design
| Next, we iterate through these dedup candidate objects, reading their complete | ||
| information from the object metadata (a per-object RADOS operation). During | ||
| this step, we filter out **user-encrypted** objects. | ||
| >>>>>>> 4322f69d777 (qa/rgw: fix dedup teuthology zone setup and dedup tests refactoring) |
There was a problem hiding this comment.
is this a conflict marker?
There was a problem hiding this comment.
this is a map-reduce pattern
| decode(m.failed_rec_load, bl); | ||
| decode(m.failed_block_load, bl); | ||
| decode(m.failed_rec_overflow, bl); | ||
| decode(m.failed_wrong_ver, bl); |
There was a problem hiding this comment.
is there validity to this trivial observation by copilot @benhanokh ?
There was a problem hiding this comment.
do you mean the need for version on each struct?
The code is not production yet so the answer is no;
after 9.2 is out it will be used as version-1 and every change past it will require new verison
|
@benhanokh Please open an Enhancement tracker for this feature and set 'umbrella' in the backports. The 'needs-umbrella-backport' label doesn't really do anything. |
Extend full RGW object dedup to handle objects written with RGW server-side compression. Previously compressed objects were skipped entirely; they can now participate in dedup when rgw_dedup_skip_compressed is false (the default). Key changes: - Use bucket-index accounted_size (logical/uncompressed size) instead of raw object size when building dedup keys, so compressed and uncompressed copies of identical content hash to the same table entry. - Derive logical size from RGW_ATTR_COMPRESSION (orig_size) during the attribute-read phase, matching RGWRados::Object::Write::_do_write_meta. - Compute BLAKE3 over uncompressed bytes via streaming_decompressor_t, which decompresses RGW compression blocks incrementally and feeds the hasher without loading full decompressed objects into memory. - Persist RGW_ATTR_COMPRESSION in disk_record_t and mirror compression state on dedup targets (setxattr or rmxattr) so TGT tail objects remain consistent with SRC. - Prefer dedup SRC candidates whose compression algorithm matches the current placement rule (COMPRESSION_MATCH_EXACT > PARTIAL > NONE), while preserving shared-manifest SRC priority from prior dedup cycles. - Add rgw_dedup_skip_compressed (default false) to optionally retain legacy skip behavior. - Extend dedup stats and documentation for compressed-object ingress, dedup success, and compression attr updates. - Add integration tests for compression mode switches, compressed MD5 collision rejection, and incremental shared-manifest vs compression priority. Signed-off-by: benhanokh <[email protected]>
…k records Disk records must fit within MAX_REC_SIZE (~8 KiB minus block header). Large RGW_ATTR_MANIFEST and RGW_ATTR_COMPRESSION values can exceed this limit when serialized alongside object metadata. When a record would overflow: - Drop manifest_bl and compression_bl from the in-memory/disk record. - Set RGW_RECORD_FLAG_REMOTE_ATTRS on the record. - Refetch manifest, optional BLAKE3, and compression from the RADOS head object via a single getxattrs() in STEP_REMOVE_DUPLICATES (fetch_head_obj_attrs, renamed from read_hash_and_manifest). This avoids record overflow failures for multipart or heavily manifest- encoded objects while keeping the common case (small attrs) on the fast inline path. Also adds observability for record sizes and remote-attr handling: - Track max/avg bucket-index and attrs record lengths. - Counters for remote_attrs_records, failed_remote_attrs_fetch, failed_rec_overflow, failed_wrong_ver, write_slab_failure. - Wire stats through add_record() and flush paths for aggregation. Signed-off-by: benhanokh <[email protected]>
Teuthology dedup suite: - Configure realm/zonegroup/zone in qa/suites/rgw/dedup/overrides.yaml. - Pass cluster, zonegroup, and zone from teuthology context into qa/tasks/dedup_tests.py config for multisite-aware tests. - Set zone and zonegroup HTTP endpoints after realm creation in qa/tasks/rgw.py so mdlog trim passes sanity_check_endpoints. Tests: - Updated all tests to work with zone/zonegroup - Extend src/test/rgw/dedup/__init__.py with zone/cluster config helpers. - Update deduptests.conf.SAMPLE for multisite fields. - Refactor test_dedup.py layout while retaining compressed-object and mode-switch coverage. Signed-off-by: Gabriel BenHanokh <[email protected]>
b40fd15 to
a4ca752
Compare
|
10 clean cycles of the full dedup test suite |
rgw/dedup: support server-side compressed object deduplication
Summary
This PR enables full RGW object dedup for server-side compressed objects.
Compressed objects were previously excluded from dedup.
Supporting them unlocks storage savings in deployments with placement compression enabled, while placement-aware SRC selection ensures post-dedup objects align with current zone compression policy.
Compressed object dedup:
accounted_size) rather than on-disk size so compressed and uncompressed objects with the same data will show the same size in dedup-table.Large disk records:
remote_attrs, with new stats for visibility.New option:
rgw_dedup_skip_compressed(defaultfalse) preserves legacy skip behavior.Fixes: https://tracker.ceph.com/issues/80319
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.