Repository navigation
interval_map: Add non-const iterators - #63844
Conversation
The interval_map code cannot cope with iterators which change the size of an interval. Due to this, they use const iterators. However, many other modifications to intervals ARE ok and more efficient, nicer looking code can be written with them. This PR adds non-const iterators, but also adds some policing that the size of the bufferlist has not changed over the interval. Everything is hidden behind a template, as this changes the behaviour of interval map in a way that we don't want to use without careful testing of each instance. Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
e2983b8 to
9859e8d
Compare
| * behaviour. | ||
| */ | ||
| if (!end && get_val().length() != get_len()) { | ||
| throw std::out_of_range("buffer length has changed"); |
There was a problem hiding this comment.
Do we really envision recovery from such an situation.
If not, then perhaps ceph_abort_msg() would be simpler.
There was a problem hiding this comment.
ceph aborts and asserts are hard to unit test, which is why this is an exception. I don't really expect anyone to handle this.
There was a problem hiding this comment.
I am open to suggestions of how to handle abort, while keeping the unit tests which check that this exception fires.
| * to be merged into the next one, which would allow for unexpected | ||
| * behaviour. | ||
| */ | ||
| if (!end && get_val().length() != get_len()) { |
There was a problem hiding this comment.
IIUC this is supposed to detect change in the size of the previous element (the one the iterator leaves).
There was a problem hiding this comment.
Correct. The idea is that when the client increments the iterator, that the length of the bufferlist has not changed. All other aspects of the bufferlist can be changed (contents, internal structure, zeros, etc... )
|
jenkins test api |
|
@aainscow pls merged when api tests passed |
|
Jenkins test api |
|
This is a pre-req for the zero-detect work. |
The interval_map code cannot cope with iterators which change the size of an interval. Due to this, they use const iterators. However, many other modifications to intervals ARE ok and more efficient, nicer looking code can be written with them.
This PR adds non-const iterators, but adds some policing that the size of the bufferlist has not changed over the interval.
Everything is hidden behind a template, as this changes the behaviour of interval map in a way that we don't want to use without careful testing of each instance.
Tracker: https://tracker.ceph.com/issues/72366
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 Definition