Repository navigation
osd: Modify erasure code plugins ready for new EC - #61804
Conversation
5f8f261 to
f9b706f
Compare
rzarzynski
left a comment
There was a problem hiding this comment.
First part of the review.
There was a problem hiding this comment.
nit: I would just drop the commented code.
There was a problem hiding this comment.
Will do. Was left in by mistake
There was a problem hiding this comment.
🥇 for verifying these properties.
There was a problem hiding this comment.
nit: too aggressive line wrapping; around 78th column would be fine.
There was a problem hiding this comment.
Is there a reason for using an output-param instead just returning the new ptr?
There was a problem hiding this comment.
This is to allow the caller to re-use the same buffer for both old_data and delta.
There was a problem hiding this comment.
Understood. If want to avoid the ref counter management, then fine. However, please be aware buffer::ptr is only a kind-of smart pointer managing the buffer::raw.
There was a problem hiding this comment.
👍 for the immutability.
There was a problem hiding this comment.
Not sure what you are seeing here?
There was a problem hiding this comment.
nit: continue in new line.
rzarzynski
left a comment
There was a problem hiding this comment.
Reivewi for common: bitset_set and mini_flat_map. Looks good, mostly nits + a question.
There was a problem hiding this comment.
nit: NumBitsV and KeyT?
There was a problem hiding this comment.
Is there a use case for this int-specific overload?
There was a problem hiding this comment.
Yes. This was required for some compatibility issues when coverting from old code with set to bitset_sets. Potentially we can eventually refactor all of those out and delete this overload, but it is required for now.
There was a problem hiding this comment.
ack.Old habits die hard.
There was a problem hiding this comment.
nit: let's not try to save on new lines.
There was a problem hiding this comment.
I will reformat the file according to code standards.
There was a problem hiding this comment.
nit: GH signals lack of \n?
left a comment
There was a problem hiding this comment.
First round finished!
Generally speaking this looks sane. Most comments are about nits (please take a look on https://github.com/ceph/ceph/blob/main/CodingStyle); some are questions.
There was a problem hiding this comment.
🥇
I very, very like the idea of improving type safety.
There was a problem hiding this comment.
nit: they don't need to be oneliners.
There was a problem hiding this comment.
Is the lack of versioning facilities intentional?
There was a problem hiding this comment.
I think this chunk should be dissected and get squashed with the commits that introduces and container.
There was a problem hiding this comment.
Doesn't this deserve a dedicated commit and description?
There was a problem hiding this comment.
Maybe let's introduce a temporary to make this condition easier to read.
commented
Feb 26, 2025
|
I have found some significant teuthology failures in this PR and am doing some refactoring. Hopefully I will have these in the next couple of days. |
a15e870 to
722d922
Compare
722d922 to
4e51428
Compare
commented
Mar 6, 2025
commented
Mar 6, 2025
|
jenkins test api |
4e51428 to
becb006
Compare
commented
Mar 7, 2025
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
becb006 to
5d06529
Compare
commented
Mar 9, 2025
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Add flags to erasure code plugins to report supported optimizations and new unittest_erasure_code_plugins to test these flags for many permutations of plugins and profiles. Signed-off-by: Bill Scales <[email protected]> [Taken from Bill's fork with permission] Signed-off-by: Jamie Pryde <[email protected]>
This commit adds FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION to the list of optimizations supported by the ISA plugin, and encode_delta and apply_delta functions to ISA. Stubs for these functions are added to the other plugins. Two new tests have been added to TestErasureCodePlugins.cc to test the encode_delta and apply_delta functions. The first new test updates a single parity chunk using a single delta. The second new test updates all parity chunks with a delta for every data chunk. Signed-off-by: Jamie Pryde <[email protected]> Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
This commit adds FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION to the list of optimizations supported by the Jerasure plugin, and encode_delta and apply_delta functions for all Jerasure techniques. Signed-off-by: Jamie Pryde <[email protected]> Signed-off-by: Alex Ainscow <[email protected]>
This commit adds FLAG_EC_PLUGIN_PARITY_DELTA_OPTIMIZATION to the list of optimizations supported by the SHEC plugin, and encode_delta and apply_delta functions. Signed-off-by: Jamie Pryde <[email protected]> Signed-off-by: Alex Ainscow <[email protected]>
Add get_minimum_granularity() function to the EC plugin interface, which returns the minimum size in bytes that can be used for partial writes. This is based on the minimum size of coding chunk update that the particular technique supports. Signed-off-by: Jamie Pryde <[email protected]>
Signed-off-by: Jon Bailey <[email protected]>
… are supplied in erasure code profiles Signed-off-by: Jon Bailey <[email protected]>
We have changed the encode_chunks interface to take an in map and an out map. The in map contains the data shards to be encoded. The out map contains the empty buffers that the plugin will write the parity data to. The old non-optimized EC path has been updated to call the new encode_chunks interface from erasurecode.cc The new EC optimizations path calls the encode_chunks interface from ECUtils. Signed-off-by: Jamie Pryde <[email protected]> Signed-off-by: Alex Ainscow <[email protected]>
110a374 to
6b733e9
Compare
|
|
||
| private: | ||
| int chunk_index(unsigned int i) const; | ||
| }; |
There was a problem hiding this comment.
I assume the changes above were only about reidentation.
There was a problem hiding this comment.
Understood. If want to avoid the ref counter management, then fine. However, please be aware buffer::ptr is only a kind-of smart pointer managing the buffer::raw.
| // Otherwise, use byte_xor() | ||
| bool aligned = true; | ||
| for (int i = 0; i <= data_vectors; i++) { | ||
| aligned &= is_aligned(xor_bufs[i], EC_ISA_ADDRESS_ALIGNMENT); |
There was a problem hiding this comment.
Hmm, this is the bitwise AND. Can this be anyhow harmful, particularly on exotic archs?
There was a problem hiding this comment.
We could exit the loop early too.
There was a problem hiding this comment.
Note that we have always used
aligned &= is_aligned(xor_bufs[i], EC_ISA_ADDRESS_ALIGNMENT);
This code was moved from xor_op.cc in #58594
I think
if (!is_aligned... might be safer though
| const bufferptr &new_data, | ||
| bufferptr *delta) | ||
| { | ||
| constexpr int data_vectors = 2; |
There was a problem hiding this comment.
nit: per the convention it would better (more readable) to capitalize the name (NUM_DATA_VECTORS)
| const unsigned blocksize = first->second.length(); | ||
|
|
||
| for (auto const& [datashard, databuf] : in) { | ||
| if (datashard < k) { |
There was a problem hiding this comment.
nit: flapping the condition and using continue could save one indentation level.
| erasures.insert(i); | ||
| } else { | ||
| (*decoded)[i] = chunks.find(i)->second; | ||
| (*decoded)[i].rebuild_aligned(SIMD_ALIGN); |
There was a problem hiding this comment.
I don't recall whether rebuld_aligned early-exists if the buffer is already aligned.
There was a problem hiding this comment.
It returns true if a rebuild was required, so there is an early exit here. There might however be some optimisations here for a later date, as new EC should always supply 4k-aligned buffers. I will explore later.
| (*decoded)[i].rebuild_aligned(SIMD_ALIGN); | ||
| } | ||
| bufferlist &bl = (*decoded)[i]; | ||
| if (bl.length() != bl.begin().get_current_ptr().length()) { |
There was a problem hiding this comment.
nit: bufferlist has all the getters. Right now I recall get_num_buffers() but with 90% certainty I think is_contigous() is already in place.
There was a problem hiding this comment.
is_contiguous does exist. I will update.
| shard_id_map<bufferptr> in(get_chunk_count()); | ||
| shard_id_map<bufferptr> out(get_chunk_count()); | ||
| for (auto&& [shard, list] : *decoded) { | ||
| auto bp = list.begin().get_current_ptr(); |
There was a problem hiding this comment.
list.front() returns a ptr_node, rather than a ptr, so this would not a simple drop in replacement. I am going to leave this one for now... I think the above is clear in its intention.
| unsigned int width = get_chunk_count() * get_chunk_size(in.length()); | ||
| bufferptr pad(width - in.length()); | ||
| pad.zero(0, get_data_chunk_count()); | ||
| out.push_back(pad); |
There was a problem hiding this comment.
WIll do. Strange that zero length and pad size are not the same.
| // OSD and if CPU is cheap, it could make sense to recover | ||
| // instead of fetching the chunk. | ||
| // | ||
| shard_id_map<int> c2c(available); |
There was a problem hiding this comment.
nit: looks a bit duplicative. Perhaps worth deduplicating later.
There was a problem hiding this comment.
This will be deleted when we remove legacy EC
commented
Mar 31, 2025
|
Some of the "nits" I think deserve some further testing, so I will keep them for a later commit. |
This is all the changes required for the EC plugins for new EC. This is a fairly significant list:
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 retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e