Repository navigation
doc: Add EC sparse reads and logical allocation design documents - #69313
Conversation
Add comprehensive design and implementation plan for supporting sparse reads and logical allocation preservation on Erasure Coded pools. Key features: - Sparse read support that accurately reports allocation state - Force-allocated extent tracking to preserve explicitly written zeros - Support for both client-side and OSD-side zero detection - Optimized to only consult metadata during recovery/reconstruction - 4K block granularity aligned with EC, LUKS2, and fscrypt The design addresses the core issue where EC pools cannot distinguish between explicitly written zeros and never-allocated regions during recovery/reconstruction, which prevents reliable use of encryption and other features requiring accurate logical allocation state. Implementation plan includes 5 phases with 27 discrete stories and effort estimates of 67-89.5 days depending on implementation options. Signed-off-by: Alexander Ainscow <[email protected]>
0ff2690 to
29dff26
Compare
|
|
||
| 1. Enable zero-block tracking on the EC pool:: | ||
|
|
||
| ceph osd pool set <ec-pool> set_pool_flags 4194304 --yes-i-really-mean-it |
There was a problem hiding this comment.
This is a development tool and requires the
--yes-i-really-mean-itconfirmation flag.
How do you see the non-development interface looking like? Something along the lines of ceph osd pool set <ec-pool> track_zero_blocks true?
There was a problem hiding this comment.
I am going to delete this whole section on configuration - its just repeating above and I don't think we need it yet. I will replace it with a section making clear that we need to update the docs.
| **Current State** | ||
|
|
||
| CephFS fscrypt operates at the MDS level and does not have explicit EC pool | ||
| restrictions. The fscrypt implementation works with file metadata and should |
There was a problem hiding this comment.
Nit: This makes sound like fscrypt only conceals file metadata and does nothing with file data.
There was a problem hiding this comment.
I am going to delete this section, I don't think it adds any value.
| - If recovered block is all zeros, deallocate it | ||
| - Otherwise write it as-is |
There was a problem hiding this comment.
Nit: I'd break this into "data has been recovered" and "no data has been recovered" branches, matching the structure of the force-allocated case for clarity.
| 2. **Pool flag**: A pool flag (``FLAG_TRACK_ZERO_BLOCKS``) enables tracking for | ||
| all objects in the pool. Set via ``ceph osd pool set <pool> set_pool_flags |
There was a problem hiding this comment.
I'm not sure if this sits with
Note: While object_info_t is generally suitable for this metadata, if extensive force-allocated extent tracking becomes necessary, alternative storage mechanisms should be evaluated.
well. If the user has a whole bunch of RBD images in the EC pool with only a few images encrypted and they set the flag because of them, the system would be entirely at the mercy of a pile of unencrypted workloads. In the extreme worst case, each OI would have 512 intervals (so taking up ~8K on disk), not to mention the continuous overhead from mem_is_zero().
There was a problem hiding this comment.
An alternative to a pool level flag would be to have a request (MOSDop or even per op in MOSDop) flag that indicates if zero block detection should be performed. This would require client side changes to set this flag for encrypted RBD images, but might avoid some of the concerns about performance / amount of extra metadata for unencrypted images.
We could of course implement both a pool level flag and an I/O level flag to provide options as to how this feature is deployed (the pool level flag has the advantage of not requiring clients to be upgraded)
There was a problem hiding this comment.
We are doing both options. I have updated the design so the pathological case works (2GiB object, with alternating blocks of data/force allocated extents).
|
|
||
| **Note:** While object_info_t is generally suitable for this metadata, if | ||
| extensive force-allocated extent tracking becomes necessary, alternative | ||
| storage mechanisms should be evaluated. |
There was a problem hiding this comment.
- What is the best way of tracing the force-allocated extents
If force-allocated extents are rare then an interval map is the best way to track them as most objects will have an interval map with 0 or 1 entry.
The pathological worse case scenario is where every other 4K block of an object is force allocated. For a 4M object that would require 512 entries in the interval set. Here a bitmap would be the most efficient way of tracking allocated extents.
Bluestore has a similar problem with its allocators and switches between a complex data structure which is more efficient when there is little fragmentation and a bitmap which is more memory efficient. A similar approach could be used here.
There was a problem hiding this comment.
We are going to switch between an interval_set of uint32_t and a bitmap, once the interval_set hits 128 entries. 128 represents the point at which sizeof(interval_set) == sizeof(bitmap) for a 4MiB object. Otherwise it is arbitrary. I don't think we need it as a config option.
| stores this information in object metadata (``force_allocated_extents``), and | ||
| uses it during recovery/reconstruction to preserve the distinction between | ||
| allocated-zeros and unallocated regions. | ||
|
|
There was a problem hiding this comment.
Is force_allocated_extents only an EC feature, or should we use this for Replica pools as well?
Perhaps the other way of asking this is should we make the same optimization of detecting and not writing zeros when recovering data in a Replica pool as we do in a FastEC pool?
There was a problem hiding this comment.
There may be reasons for doing a zero-detect in replica - but I don't think we should use force_allocated_extents. The design is to only read force_allocated_extents on recovery - and this only applies to EC, not Replica.
Lets leave the zero-detection general, so it can be used later in Replica
| **Behavior when tracking is enabled:** | ||
|
|
||
| 1. If writing non-zero data: no action needed on ``force_allocated_extents`` | ||
| 2. If writing zeros: add the written extent to ``force_allocated_extents`` |
There was a problem hiding this comment.
Currently a writesame of zeros creates a write transaction, if we are tracking this in force_allocated_extents we could use a zero transaction instead which can be more efficient in EC and the ObjectStore
There was a problem hiding this comment.
A "ZERO" operation is intended to deallocated. A write-same is intended to allocate zeros. An earlier design point is to not parse force_allocated_extents on non-recovery reads, so we cannot apply this optimisation without changing that design point.
| 2. **Pool flag**: A pool flag (``FLAG_TRACK_ZERO_BLOCKS``) enables tracking for | ||
| all objects in the pool. Set via ``ceph osd pool set <pool> set_pool_flags |
There was a problem hiding this comment.
An alternative to a pool level flag would be to have a request (MOSDop or even per op in MOSDop) flag that indicates if zero block detection should be performed. This would require client side changes to set this flag for encrypted RBD images, but might avoid some of the concerns about performance / amount of extra metadata for unencrypted images.
We could of course implement both a pool level flag and an I/O level flag to provide options as to how this feature is deployed (the pool level flag has the advantage of not requiring clients to be upgraded)
49c4b5f to
75d2598
Compare
a1738bb to
cec663f
Compare
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
| and reconstruction. This requires zero-detect to be enabled. | ||
|
|
||
| The core technical challenge is that EC pools maintain allocation information | ||
| at 4K resolution during normal operations, but this information is lost during |
| by either of two independent mechanisms: | ||
|
|
||
| - **Pool property** (``preserve_allocation``): enables zero detection for | ||
| every write to every object in the pool. Simple to deploy — no client |
There was a problem hiding this comment.
This is straightforward to implement without client changes.
cec663f to
9140b3c
Compare
During implementation of sparse reads, more design decisions have been required. These are now reflected in the design document. Fixes: https://tracker.ceph.com/issues/79804 Signed-off-by: Matty Williams <[email protected]> Signed-off-by: Alex Ainscow <[email protected]> Assisted-by: IBM-Bob-2.1.0:Claude/GPT
9140b3c to
b52b109
Compare
|
This is an automated message by src/script/redmine-upkeep.py. I found one or more
The referenced tickets are: Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them. |
Add comprehensive design and implementation plan for supporting sparse reads and logical allocation preservation on Erasure Coded pools.
Key features:
The design addresses the core issue where EC pools cannot distinguish between explicitly written zeros and never-allocated regions during recovery/reconstruction, which prevents reliable use of encryption and other features requiring accurate logical allocation state.
Implementation plan includes 5 phases with 27 discrete stories and effort estimates of 67-89.5 days depending on implementation options.
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.