Repository navigation
osd/PrimaryLogPG: redirect non-sparse EC direct reads that hit -EIO to the primary - #72292
Conversation
a62177a to
1719ce5
Compare
1719ce5 to
da5b557
Compare
…eadEIO Answers Jon Bailey's review comment on TestBackendBasics.DirectReadEIO in ceph#72292 (ceph#72292 (comment)): the test never reaches PrimaryLogPG::do_read(), the code changed by "osd/PrimaryLogPG: redirect non-sparse EC direct reads that hit -EIO to the primary", so it passes with or without that change. Remove it. Add TEST_ec_direct_read_eio to test-erasure-eio.sh, which does go through do_read(). It sets allow_ec_optimizations on a k=2 m=1 pool, which gives the pool split_reads, injects a data EIO on shard 1 of a 20 KiB object and reads the whole object with rados_replica_read_policy=balance. The client splits the read into direct reads of shards 0 and 1. Without the change, shard 1 returns -EIO and rados get fails with (5) Input/output error. With it, shard 1 answers -EAGAIN and the client sends the read to the primary, which decodes around shard 1. The test compares the data and checks for the EAGAIN line in shard 1's OSD log. To be squashed into "test/osd: check EC direct reads of a bad local shard return -EIO for a retry" before merge; the squashed commit then only adds the standalone test and needs a title and message to match. The last paragraph of the fix commit's message, which points at the unit test, needs rewording to match too. Assisted-by: Claude Code
JonBailey1993
left a comment
There was a problem hiding this comment.
LGTM, PR just needs the squashing and commit rewording to be done that the final commit message talks about.
1be4fbf to
a47eeae
Compare
|
Thanks Jon. The squash and rewording are done: the PR is rebased on main (the #71910 commits dropped out as they are merged), the test commits are squashed into 3361f18, and the last paragraph of b21cff5 now points at the standalone test. I've also added a47eeae, a fix to the test_ec_sparse_read_repair_assert.sh workunit from #71910. |
…o the primary Builds on "osd: rep_repair_primary_object needs to handle direct reads" (PR ceph#71910), which makes rep_repair_primary_object() fail an EC read with -EAGAIN instead of asserting, so the sparse path (do_sparse_read) now bounces an EC direct read that hits -EIO or a full-object crc mismatch back to the client for a retry at the primary. An EC direct read only reads the local shard, so it cannot reconstruct around a medium error. The design (ec_stretch_cluster.rst 7.2 and direct_reads.rst) requires any such failure to send the client back to the primary, which can decode from the other shards (in a stretch pool, from remote-zone shards if need be). The non-sparse path (do_read, objects_read_local) still passed -EIO straight back to the client, failing the application's read. Call rep_repair_primary_object() from the non-sparse EC direct-read path on -EIO, as the replicated path does, so it takes the same -EAGAIN bounce, which the Objecter (and SplitOp) resubmits to the primary without the direct-read flags. -EAGAIN from do_osd_ops() means the reply has already been sent, so execute_ctx() just closes the context. Replicated pools and non-direct EC reads are unchanged. The next commit adds a standalone test that takes this path. Fixes: https://tracker.ceph.com/issues/81286 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
…e primary Tests "osd/PrimaryLogPG: redirect non-sparse EC direct reads that hit -EIO to the primary". Add TEST_ec_direct_read_eio to test-erasure-eio.sh. It sets allow_ec_optimizations on a k=2 m=1 pool, which gives the pool split_reads, injects a data EIO on shard 1 of a 20 KiB object and reads the whole object with rados_replica_read_policy=balance. The client splits the read into direct reads of shards 0 and 1. Without the fix, shard 1 returns -EIO and rados get fails with (5) Input/output error. With it, shard 1 answers -EAGAIN and the client sends the read to the primary, which decodes around shard 1. The test compares the data and checks for the EAGAIN line in shard 1's OSD log. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
test_ec_sparse_read_repair_assert.sh sets osd_pool_default_flag_ec_optimizations with `ceph config set osd`, but only the monitor reads that option, so the pool is created without EC optimizations. The check `grep -q allow_ec_optimizations` also matches "allow_ec_optimizations: false". The sparse read only takes the EC direct read path because the first ceph_test_rados_io_sequence run enables allow_ec_optimizations on the pool it is given. Set allow_ec_optimizations on the pool, drop the config option, and check that the flag is true and that the pool has split_reads before writing the object. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
a47eeae to
a4d4f9a
Compare
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test api |
|
This PR has been added to wip-bharath10-testing-20261012.232418-main. |
|
jenkins test make check |
|
Bill has since been added to .githubmap. I think the branch would need to be rebased for the check to pass, but I don't think we need to go through that. |
Since 0f17b4c (ceph#72292), an EC direct read that fails with EIO on its shard goes back to the client with EAGAIN. The client then sends the read to the primary, which decodes the data from the other shards. Only a debug log line shows such a bounce, so a damaged shard that clients read again and again stays hidden. Now the shard counts each bounce in the new perf counter ec_direct_read_redirect_eio, and writes it to the OSD log. The cluster log gets the 1st, 2nd, 4th, 8th and later bounces of each PG. If fiemap fails with EIO, a sparse direct read also bounces. A sparse direct read also skips the whole-object digest check, because the digest does not cover the chunks of one shard. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyle Bader <[email protected]>
Since 0f17b4c (ceph#72292), an EC direct read that fails with EIO on its shard goes back to the client with EAGAIN. The client then sends the read to the primary, which decodes the data from the other shards. Only a debug log line shows such a bounce, so a damaged shard that clients read again and again stays hidden. Now the shard counts each bounce in the new perf counter ec_direct_read_redirect_eio, and writes it to the OSD log. The cluster log gets the 1st, 2nd, 4th, 8th and later bounces of each PG. If fiemap fails with EIO, a sparse direct read also bounces. A sparse direct read also skips the whole-object digest check, because the digest does not cover the chunks of one shard. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyle Bader <[email protected]> Signed-off-by: Alex Ainscow <[email protected]>
An EC direct read, used by balanced and localized reads, reads only the shard on
the OSD it is sent to, so that OSD cannot rebuild the data around a medium error.
The read must be sent back to the primary, which can decode it from the other
shards. For a non-sparse read (
CEPH_OSD_OP_READ) this does not happen: theclient gets -EIO, and every retry hits the same bad sector.
Fixes: https://tracker.ceph.com/issues/81286
What goes wrong
In
PrimaryLogPG::do_read(), theec_direct_read()branch callsECBackend::objects_read_local(). That returns the object store's -EIO unchanged,and
do_read()passes it straight back as the op result. It does not callrep_repair_primary_object(), as the replicated branch of the same function does.The Objecter only resubmits to the primary on -EAGAIN, and
SplitOpreturns thefirst non-EAGAIN error from its sub-reads. So a single direct read and a split
read both fail with -EIO, and the primary is never asked.
This affects any client using
read_from_replicabalance or localize on anoptimized EC pool, for example librbd with
rbd_read_from_replica_policy.Fix
On -EIO, the non-sparse EC direct-read branch of
do_read()now callsrep_repair_primary_object(), as the replicated path does. With #71910 thatreplies -EAGAIN, and the Objecter (or
SplitOp) resubmits the read to theprimary without the direct-read flags. -EAGAIN from
do_osd_ops()means the replyhas already been sent, so
execute_ctx()just closes the context; that isexisting behaviour.
Replicated pools and EC reads that are not direct reads are unchanged.
Relationship to #71910
#71910 fixes the sparse-read side:
do_sparse_read()callsrep_repair_primary_object()on -EIO or on a full-object CRC mismatch. Thatfunction asserted the pool was not erasure coded, so a medium error hit by a
localized RBD read aborted the OSD. #71910 replaces the assert with an -EAGAIN
reply whenever the OSD is not the primary or the pool is erasure coded. It does
not touch the non-sparse
do_read()path, which this PR fixes. The change here isthree lines, and it relies on #71910's version of
rep_repair_primary_object().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.