Repository navigation
osdc/Objecter: pause order-reads-writes ops on a full pool - #72289
Conversation
7284b14 to
01b78cb
Compare
01b78cb to
2603058
Compare
|
This PR has been added to wip-bharath7-testing-20261012.100201-main. |
bill-scales
left a comment
There was a problem hiding this comment.
Changes to Objecter.cc look sound but are hard to review, spent a lot of time checking these out. Would like a second opinion review of these.
Test case is very neat in how it tests Objecter, but its got too many magic numbers which makes it hard to review. I'm not keen on the test case that relies on one thread executing while another thread sleeps as this is liable to cause false positives if the system running the test decides not to schedule a thread for a while.
| TEST_F(TestSplitOpMapChange, ECSplitReadRedrivesWhenOtherShardOsdDown) | ||
| { | ||
| split_read_redriven_on_new_interval([this](int victim) { | ||
| mark_down(acting[0] + acting[1] + acting[2] - primary - victim); |
There was a problem hiding this comment.
This needs a comment - performing arithmetic on OSD ids to decide which one to mark out is obscure. The code works because there are 3 OSDs in the acting set, one of them is the primary and another one of them is the victim, so this arithmetic chooses the other OSD in the acting set which isn't the primary or victim. The code assumes primary and victim are both part of the acting set and are different.
There was a problem hiding this comment.
The arithmetic is gone. The split read's outstanding sub-read is always the one to osd.1 (shard1_osd), so the helper no longer searches for a victim, and the tests mark down parity_osd or shard1_osd by name. This is squashed into "test/osdc: demonstrate EC direct reads not failed back on a new interval" in #72236.
| void mark_down(int osd) | ||
| { | ||
| advance_map([osd](OSDMap::Incremental& inc) { | ||
| inc.new_state[osd] = CEPH_OSD_UP; |
There was a problem hiding this comment.
nit: Add comment explaining that this incremental state is xored with current state like this one in OSDMap.h:
// XORed onto previous state.
There was a problem hiding this comment.
Done: mark_down() now says that new_state is XORed onto the current state, so setting CEPH_OSD_UP clears it.
| direct_read_redriven_on_new_interval([this] { raise_min_size(); }, primary); | ||
| } | ||
|
|
||
| // The relock delay makes _op_submit() drop the rwlock for a second after the |
There was a problem hiding this comment.
Not very keen on this test as it is relying on threads running in a timely fashion - this could cause false positives if the system running the test decides to delay scheduling the test.
There was a problem hiding this comment.
Agreed. I've removed the threaded test from #72236; its production code is unchanged from what was approved.
This PR now has a deterministic, single-threaded replacement:
- "osdc/Objecter: let a test run code in the injected relock delay" turns the
sleep(1)thatobjecter_debug_inject_relock_delayadds while_op_submit()has the rwlock dropped into a replaceablerelock_delayfunction object. It defaults to the same sleep and is only called under the debug option, so nothing changes when the option is off. - "test/osdc: land a map while a split read's first sub-read relocks" adds
ECSplitReadNewIntervalDuringSubmit, which replaces it to raise min_size from inside that window, on the same thread. It fails without either of the two osdc/Objecter: re-target forced-OSD direct reads when the PG changes #72236 fixes it covers: the stale sub-read is sent to osd.1, or the client hits thecheck_latest_map_opsassert in_finish_op().
Could you re-review the test changes in #72236 as well? They are squashed into its test commit.
| }; | ||
|
|
||
| class TestSplitOpMapChange : public ::testing::Test { | ||
| protected: |
There was a problem hiding this comment.
The tests are very hard to review, there are too many magic constants scattered through the code to be clear what the test configuration is. I think you need a description of the test setup, perhaps with simple diagram showing:
- There are 6 OSDs
- An EC pool with 1 PG with an acting set [0,1,2]
- A chunk size of 4K
Hence read 0-4K is sent to OSD 0 (shard 0), read 4K-4K is sent to OSD 1 (shard 1), read 0-8K is split and sent to both OSD 0 and 1.
There was a problem hiding this comment.
The file comment now draws the setup: 4 OSDs, a 2+1 EC pool with 4K chunks and one PG, 1.0, with acting [0,1,2], which OSD holds which shard, and where the 04K, 4K4K and 0~8K reads go. The tests use named OSDs (primary, shard1_osd, parity_osd, spare_osd), chunk_size and pgid instead of literals. Only 4 OSDs are needed now that no test moves the PG to other OSDs.
| } | ||
| } | ||
|
|
||
| mark_down(num_osds - 1); |
There was a problem hiding this comment.
maybe define unreleated_osd = num_osds -1 to make it clear this is taking down an OSD that isn't part of the acting set
There was a problem hiding this comment.
Now mark_down(spare_osd), with a comment that a map leaving PG 1.0 alone leaves the sub-read alone. SetUp() also says why the spare OSD is outside the PG: the OSDs are left out, so CRUSH maps the PG nowhere and only its pg_temp gives it an acting set.
| @@ -0,0 +1,394 @@ | |||
| // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- | |||
There was a problem hiding this comment.
Should the test be in src/test/osdc/ now we've made a separate directory for client tests?
There was a problem hiding this comment.
Yes, it is now src/test/osdc/test_objecter_direct_reads.cc. The binary keeps its name.
|
@adamemerson would you mind being a 2nd reviewer for the changes to Objecter.cc, I'm fairly convinced the changes are good but some of these aren't simply bugs that are being fixed. |
If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which aborts without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
_op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which fails without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
2603058 to
e4e9d4f
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which aborts without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
_op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which fails without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
|
This PR has been removed from wip-bharath7-testing-20261012.100201-main. |
e4e9d4f to
25aa5d8
Compare
|
jenkins test make check |
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
…l pool Tests "osdc/Objecter: pause order-reads-writes ops on a full pool". op_target_t::respects_full() holds for CEPH_OSD_FLAG_WRITE and for CEPH_OSD_FLAG_RWORDERED ops, and _scan_requests() force-resends both when a pool fills or has space again, so an ORDER_READS_WRITES read must be paused on a full pool along with the writes ahead of it. The tests use the TestSplitOpMapChange harness, which drives a real Objecter, with a new set_pool_full() helper that applies a map setting or clearing pg_pool_t::FLAG_FULL on the pool; raise_min_size() shares its map update through a new modify_pool() helper, and submit_write() submits a WRITEFULL. The first two each submit a write and then an RWORDERED read to the same PG. RWOrderedReadWaitsForWriteOnFullPool submits both while the pool is full and expects neither to be sent until it has space, then the write before the read. RWOrderedReadResentAfterWriteWhenPoolFull fills the pool with both in flight and expects nothing to be resent until it has space, then the write before the read. Without the fix both fail: the read is sent, or resent, while the write is paused. advance_map() now wants the next OSDMap from the MonClient before delivering each map: a paused op makes the Objecter ask for the next map, and the unconnected MonClient would otherwise try to open a session. RWOrderedFullTryReadSentOnFullPool checks that an RWORDERED read with CEPH_OSD_FLAG_FULL_TRY, which does not respect the full flag, is still sent on a full pool. It passes with or without the fix. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
The comments on the forced-OSD handling from ceph#72236 left the reader to work out the rule: - In _op_submit(), say how a direct read's target can be from an older map: one can land while an earlier sub-read relocks. - Above the new-interval check in _calc_target(), say why a forced-OSD target must notice every new interval, not only a primary change. - In the fail-back block, state the rule and its two outcomes in one comment instead of four stacked lines. No change in behaviour. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
With objecter_debug_inject_relock_delay set, _op_submit() sleeps for a second with the rwlock dropped, so that a map from another thread can land while it relocks. A test that relies on that has to win a race with the sleep. Make the sleep the default of a function object, relock_delay, that a test can replace to land the map from inside the window, on the same thread and with no timing involved. It is only called where the sleep was, under the debug option, so nothing changes when the option is off. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Test a map landing during _op_submit()'s relock without a second thread or a sleep. ECSplitReadNewIntervalDuringSubmit sets objecter_debug_inject_relock_delay and replaces relock_delay with code that turns the option off again, so that only the first sub-read of a balanced EC split read relocks, and raises the pool's min_size while _op_submit() has the rwlock dropped. The PG starts a new interval. The first sub-read is recalculated after the relock and parked. The second, whose target was copied from the parent before the map, must be recalculated too rather than sent to osd.1. The next map that changes the PG fails both back, and the whole read is redriven to the primary. This covers two fixes from ceph#72236: without "osdc: recalculate EC direct-read targets from an older map at submit" the second sub-read is sent to osd.1, and without "osdc: cancel the map check when _check_op_pool_dne() completes an op" the client aborts when the next map fails the parked sub-reads. advance_map()'s comment now also names ops left without an OSD, as the parked sub-reads are, as a reason the Objecter asks for the next map. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
25aa5d8 to
879cc6c
Compare
|
This PR has been added to wip-bharath18-testing-20261029.065635-main. |
An
ORDER_READS_WRITES(CEPH_OSD_FLAG_RWORDERED) read must not complete beforewrites submitted ahead of it. On a full pool the Objecter pauses those writes, but
it lets the RWORDERED read through, so the read overtakes them.
ceph_test_radosaborts withfinished tid 1 when last_acked_tid was 3when an OSDgoes failsafe-full. The same abort reproduces on a replicated pool by pulsing a
max_objectsquota underceph_test_rados. This is not specific to EC or stretchpools. The code is the same on main, Tentacle and Squid, and has been since
Octopus.
Fixes: https://tracker.ceph.com/issues/81205
Cause
op_target_t::respects_full()treats RWORDERED ops like writes, so_scan_requests()force-resends them when a pool fills or gets space again.target_should_be_paused(), however, folds the full-pool check into the PAUSEWRcondition, and only
CEPH_OSD_FLAG_WRITEops test that condition. An RWORDEREDread already in flight when the pool fills is therefore resent at once.
c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full",
https://tracker.ceph.com/issues/19133) also made
_op_submit()pause every op thatrespects_full(). c0482d7 ("osdc/Objecter: remove duplicated pause check code",v15.1.1) removed that check as a duplicate. Since then, RWORDERED reads submitted
while the pool is full are not paused either.
Fix
target_should_be_paused()now pauses every op thatrespects_full()while itspool or the cluster is full. The RWORDERED read waits with the writes ahead of it.
Once the pool has space,
_scan_requests()resends them in tid order.What does not change:
FULL_TRYandFULL_FORCEops are still sent.CEPH_OSD_FLAG_RWORDEREDare not affected.As before c0482d7, the in-tree RWORDERED readers now wait while their pool is
full:
Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use. TheMDS's Objecter ignores pool full, so the MDS is not affected.
Dependency
This PR is stacked on #72236. The fix itself is one hunk in
Objecter::target_should_be_paused()and stands alone. The tests extend that PR'sunittest_objecter_direct_reads(TestSplitOpMapChange, a real Objecter driventhrough maps and replies). Until #72236 merges, this PR also shows its commits.
The last five commits belong here:
osdc/Objecter: pause order-reads-writes ops on a full pooltest/osdc: check that RWORDERED reads do not overtake writes on a full poolosdc/Objecter: reword the comments on forced-OSD and direct-read targetsosdc/Objecter: let a test run code in the injected relock delaytest/osdc: land a map while a split read's first sub-read relocksThe last three follow up #72236, whose production code stays as approved. Review
asked for its timing-dependent race test to go, and a deterministic replacement
needs a hook in the Objecter. The hook turns the
sleep(1)ofobjecter_debug_inject_relock_delayinto a function object that defaults to thesame sleep, so nothing changes when the option is off.
Testing
New tests in
unittest_objecter_direct_reads:RWOrderedReadWaitsForWriteOnFullPool: a write and then an RWORDERED readsubmitted while the pool is full. Neither is sent until the pool has space, and
then the write goes before the read.
RWOrderedReadResentAfterWriteWhenPoolFull: the pool fills with both in flight.Nothing is resent until it has space, and then the write goes before the read.
RWOrderedFullTryReadSentOnFullPool: an RWORDERED read withFULL_TRYis stillsent on a full pool.
ECSplitReadNewIntervalDuringSubmit: raises min_size from inside_op_submit()'srelock window for the first sub-read of a split read, on the same thread. Neither
sub-read is sent with its old target, and the next change to the PG redrives the
whole read to the primary.
All nine tests in the binary pass. With the fix reverted, the first two fail
because the read is sent, or resent, while the write is paused. The
FULL_TRYtestpasses either way, as expected.
ECSplitReadNewIntervalDuringSubmitfails withouteither of the two #72236 fixes it covers: the stale sub-read is sent to osd.1, or
the client aborts in
_finish_op().Depends-on #72236
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.