Skip to content

common/io_exerciser: Add consistency checking functionality to IO exerciser - #62985

Merged
connorfawcett merged 2 commits into
ceph:mainfrom
connorfawcett:wip-exerciser-consistency-2604
Jul 17, 2025
Merged

connorfawcett merged 2 commits into
ceph:mainfrom
connorfawcett:wip-exerciser-consistency-2604

Conversation

@connorfawcett

Copy link
Copy Markdown
Contributor

Depends on: #62170

This PR integrates the consistency checker with the IO exerciser to allow live consistency checking of objects as IO is being performed. A new op type ‘consistency’ has been added and the existing sequences have been updated to perform a consistency check at appropriate times, mainly when a read is done after a write or series of writes, or just before an object is deleted. This new behaviour is guarded behind a flag (—checkconsistency), the default behaviour is unchanged and the exerciser behaviour should not be changed when the flag is not specified.

Only the latest commit (e4f0a02fe0ba91166e68a210ea69d0329833fa50) is part of this PR, previous commits will go in as part of 62170.

Signed-off-by: Connor Fawcett [email protected]

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

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@JonBailey1993 JonBailey1993 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.

Only commented on latest commit as it looks like previous commits are covered in your dependent PR

Comment thread src/common/io_exerciser/IoSequence.cc Resolved
Comment thread src/common/io_exerciser/IoSequence.cc Outdated

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.

This should probably be below the barrier, so you can specify barrier and consistency together without workarounds in those cases (although I guess that introduces workarounds in the cases where you specify it together with remove...)

@JonBailey1993 JonBailey1993 May 28, 2025 •

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.

You've edited almost every sequence to do a check for consistency before a remove. I wonder instead of having a consistency=true that you have to set in every sequence if it would be better to just check for check_consistency within the if (remove) or in increment_object_size(). (I think this is the point you are trying to check for consistency in existing things, but it looks like there are a couple where you are checking after every write in which case maybe its useful having this consistency flag you can set as well).

I'm just thinking out loud if there is a way to support consistency checking so that it will apply to new sequences that are added without having to manually know to add support and check for the flag, etc. Not sure I've given the perfect solution though as maybe its not clear to sequence developers they are getting that extra check then however.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From memory I did have some trouble fitting the consistency checking into the existing logic in a way that didn't result in loads of duplicate barriers etc, but I agree this would be better if I can get it to work. I'll give it another go!

@connorfawcett
connorfawcett force-pushed the wip-exerciser-consistency-2604 branch from e4f0a02 to c78edbd Compare July 10, 2025 14:41
@connorfawcett

Copy link
Copy Markdown
Contributor Author

@JonBailey1993 I’ve made some changes based on previous discussion. After giving it some thought I think this approach makes sense but let me know if you disagree.

Any time we do a remove we will always check consistency pre-remove if consistency checking Is enabled. Sequence writers will get that for free without having to worry about it.

For writes, sequence writers will still have to decide when to perform a consistency check. My understanding is that we don’t want to do a consistency check after every write, as some sequences are testing things like multiple concurrent writes, doing barrier consistency checks in-between these would invalidate these kinds of tests. I thought about adding a write wrapper function that does a consistency check which can be called in cases where we want to check consistency after a write, but it didn’t really fit into the logic of the existing sequences where we mostly want to check consistency on the next loop after a write when doneread and donebarrier are set.

The upshot is that the changes I’ve made will make it simpler for sequence developers to add in consistency checks after writes without having to worry about workarounds for getting the barriers right in most cases.

@JonBailey1993 JonBailey1993 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.

I agree with the approach and think it sounds good. I've had a look through the changes and the code looks good to me, just one query on chunk_size which I'm curious about. Looks good to me though.

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.

How will the consistency checker react if it gets a chunk_size of 0?

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.

So I've had a bit more of a think about this line here (and the matching line for interactive mode).

So we should be able to assume the getProfile()->chunk_size values exists as long as:
a) the pool was generated by the IO sequence exerciser (not if they are precreated and passed in with the --pool flag)
b) we are not doing a dryrun

This means we can remove the guessing for the chunk size (value_or(...)) if we remove these two possibilities.

For point (a), there is a couple of options.

  1. You can modify SelectErasureProfile::selectExistingProfile to also retrieve the chunk_size of the created pool through a rest request (you might have to modify one of the ceph::messaging::json::osd structures to include chunk_size or add a new structure to retrieve it.
  2. Alternatively a much easier solution might be to add to the "checkconsistency" flag to the "disallowed_options" array in the SelectErasurePool() constructor, which give an error to the user if you supply them together.

As for dryrun, both this and the other place you are retrieving the chunk size are in the else statement of an if (dryrun), so you are safe to assume that we are not doing a dry run when we want to get the chunk size at these points, which means we can assume the profile does exist (This is what happens with km/mapping & layers above as well, where we assume if we aren't doing a dry run then one of these two options has to exist).

This should mean if you do (1) or (2) to solve (a) then you should be able to take out the value_or(4096) from both places, as it should be guaranteed the profile exists and has a chunk size. If you want to be double-y sure you can add a ceph_assert(spo.getProfile()) and ceph_assert(spo.getProfile()->chunk_size) prior to calling them and then if I'm wrong then the core dumps should give a good indication of what has gone wrong for the profile to be missing when it shouldn't be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added a new commit which has the consistency checker get the chunk size from the pool's profile which gets rid of the need for the IO exerciser to guess the chunk size (and means we don't need to have chunk size as a CLI argument for the consistency checker anymore).

I've snuck that extra commit in here, let me know what you think.

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 good to me :-)

Comment thread src/common/io_exerciser/IoSequence.cc Outdated

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.

nit: wonder if these variables might be more clear with names such as consistency_in_progress/consistency_request_sent and done_consistency, as currently done_consistency is true before it is done if I'm understanding this right.

Logically this all looks sound and I won't hold back merging over it.

@connorfawcett
connorfawcett force-pushed the wip-exerciser-consistency-2604 branch from c78edbd to e8b065b Compare July 15, 2025 10:05
@connorfawcett

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Connor Fawcett added 2 commits July 17, 2025 02:29
checking during IO sequences (disabled by default).

Signed-off-by: Connor Fawcett <[email protected]>
@connorfawcett
connorfawcett force-pushed the wip-exerciser-consistency-2604 branch from e8b065b to eb6278e Compare July 17, 2025 01:30
@connorfawcett
connorfawcett merged commit fd3bc4c into ceph:main Jul 17, 2025
@connorfawcett
connorfawcett deleted the wip-exerciser-consistency-2604 branch July 17, 2025 09:04
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.

2 participants