Skip to content

osdc: Block balanced or localized reads if pools use tiering or direct reads. - #69047

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
aainscow:block_balance_reads_on_dedupe_tiering
Sep 18, 2026
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
aainscow:block_balance_reads_on_dedupe_tiering

Conversation

@aainscow

Copy link
Copy Markdown
Contributor

Previously, there was no mechanism to block balanced or direct reads in Objecter. Equally, there are known bugs when tiering or dedupe are used on the pool, which can cause OSDs to panic.

We do not plan on supporting these features, although there are some teuthology tests which we do not yet want to throw away.

As such, this commit adds a "blocked_read_flags" which is set when we update the osd pools to prevent any op
being processed with balanced or localised reads.

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

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@aainscow
aainscow requested a review from bill-scales May 21, 2026 14:05
@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from 7555180 to bc04ee3 Compare May 21, 2026 14:08
Comment thread src/osdc/Objecter.cc Outdated
pool_full_map[it->first] = _osdmap_pool_full(it->second);
int new_blocked_flags = 0;
for (auto it = osdmap->get_pools().begin(); it != osdmap->get_pools().end(); ++it) {

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.

why a nested for loop, looks like an AI wrote the code!

@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from bc04ee3 to fba816d Compare May 21, 2026 21:14
Comment thread src/osdc/Objecter.h Outdated
@@ -2978,6 +2979,8 @@ class Objecter : public md_config_obs_t, public Dispatcher {
int ret = flags | global_op_flags |
extra_read_flags.load(std::memory_order_relaxed) |
CEPH_OSD_FLAG_READ;

flags &= ~blocked_read_flags;

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.

Should this be modifying the value of ret instead of flags?

flags is passed in by value and is only used to compare against CEPH_OSD_FLAG_RWORDERED before being destroyed.

ret is the value that is returned from this function.

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.

You are quite right... I am confused how this test appeared to pass now.

@JonBailey1993
JonBailey1993 force-pushed the block_balance_reads_on_dedupe_tiering branch from fba816d to 12db7a5 Compare June 9, 2026 11:00
@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from 12db7a5 to eda4b18 Compare June 25, 2026 10:26
@bill-scales

Copy link
Copy Markdown
Contributor

This PR is trying to address issues https://tracker.ceph.com/issues/79151 and https://tracker.ceph.com/issues/79140.

There is another PR #70908 which fixes the OSD so it doesn't assert if it receives a dedup read request on a non-primary which is the other half of the fix for https://tracker.ceph.com/issues/79140

@bill-scales bill-scales 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.

Not an ideal fix for the issue. Really we should be searching the request to see if
any of the ops are CACHE ops (as opposed to READ or WRITE ops) - or perhaps even
better checking if any of the ops are NOT READs.

However that would have a performance impact, this solution whilst crude is sufficient and doesn't have a performance impact.

@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from eda4b18 to 1cd08d7 Compare August 26, 2026 07:37
@yuriw

yuriw commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri4-testing-20260831.140425-main.

@ronen-fr

ronen-fr commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@aainscow,
Yuri's run has a failure that seems very much related. Here is an AI analysis of the failure in test 525206:

What failed
The workunit rados/test.sh exited status 1 because two gtest binaries reported FAILED tests:

ceph_test_rados_api_io_pp — 4 failed tests
ceph_test_rados_api_split_op_pp — 9 failed tests
The trailing rmdir: Directory not empty / internal.base errors at the end of teu:26060-26082 are just teardown noise triggered by the workunit having already failed — not the cause.

Single shared root cause
All 13 failures are the same parametrized variant /3, i.e. GetParam() = (true, true).

From test_cxx.h:40-44 the params are Combine(fast_ec, split_ops), and testcase_cxx.cc:410-427 maps them:

/0 (false,false) → legacy EC, no split → PASS
/1 (false,true) → legacy EC + split → SKIPPED ("Legacy EC does not support split ops")
/2 (true,false) → optimized EC, no split → PASS
/3 (true,true) → optimized EC + split ops enabled → FAIL
Every failure is an assertion from AssertOperateWithSplitOp (testcase_cxx.h:121-131) of the form:

Perf counter 'objecter.split_op_reads' has incorrect value after operate().
Expected: 1 Actual: 0
The test sets OPERATION_BALANCE_READS and osd_min_split_replica_read_size=262144, then expects the client objecter to route the read as a split-replica read and bump objecter.split_op_reads. The counter stayed at 0 — the read was never split. In other words, on the optimized-EC pool with balanced/split reads requested, the split-replica-read path simply did not engage.

Examples: split_op_cxx.cc:322 (ReadSecondShard), :338, :363; io_cxx.cc:538 (ReadOpPP), :688 (SparseReadOpPP), :720 (RoundTripPP2).

Corroborating evidence
No OSD crashes / asserts / signals in any of osd.0–7 logs, and no cluster ERR in the ceph logs — this was a clean run functionally.
The build does have the feature: the .mgr pool carries the split_reads flag in the osdmap (teuthology.log, epoch 16), so the optimized-EC/split-read code is present. The problem is that a split read was not performed for the test's fast-EC pool + balanced-read request.
Conclusion / next step
This is a real regression (or misconfiguration) in the EC split-replica-read optimization in the combined PR set (71182 / 70958 / 70556 / 69047), where reads on an optimized-EC pool with OPERATION_BALANCE_READS are no longer being split at the objecter. The owner of the EC-optimizations PR in that batch should look at why the objecter stopped taking the split path for the (fast_ec, split_ops) combination — likely a gating change around osd_min_split_replica_read_size / balanced-read handling. It is independent of your crimson watch/notify work.

@aainscow

aainscow commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@aainscow, Yuri's run has a failure that seems very much related. Here is an AI analysis of the failure in test 525206:

What failed The workunit rados/test.sh exited status 1 because two gtest binaries reported FAILED tests:

ceph_test_rados_api_io_pp — 4 failed tests ceph_test_rados_api_split_op_pp — 9 failed tests The trailing rmdir: Directory not empty / internal.base errors at the end of teu:26060-26082 are just teardown noise triggered by the workunit having already failed — not the cause.

Single shared root cause All 13 failures are the same parametrized variant /3, i.e. GetParam() = (true, true).

From test_cxx.h:40-44 the params are Combine(fast_ec, split_ops), and testcase_cxx.cc:410-427 maps them:

/0 (false,false) → legacy EC, no split → PASS /1 (false,true) → legacy EC + split → SKIPPED ("Legacy EC does not support split ops") /2 (true,false) → optimized EC, no split → PASS /3 (true,true) → optimized EC + split ops enabled → FAIL Every failure is an assertion from AssertOperateWithSplitOp (testcase_cxx.h:121-131) of the form:

Perf counter 'objecter.split_op_reads' has incorrect value after operate(). Expected: 1 Actual: 0 The test sets OPERATION_BALANCE_READS and osd_min_split_replica_read_size=262144, then expects the client objecter to route the read as a split-replica read and bump objecter.split_op_reads. The counter stayed at 0 — the read was never split. In other words, on the optimized-EC pool with balanced/split reads requested, the split-replica-read path simply did not engage.

Examples: split_op_cxx.cc:322 (ReadSecondShard), :338, :363; io_cxx.cc:538 (ReadOpPP), :688 (SparseReadOpPP), :720 (RoundTripPP2).

Corroborating evidence No OSD crashes / asserts / signals in any of osd.0–7 logs, and no cluster ERR in the ceph logs — this was a clean run functionally. The build does have the feature: the .mgr pool carries the split_reads flag in the osdmap (teuthology.log, epoch 16), so the optimized-EC/split-read code is present. The problem is that a split read was not performed for the test's fast-EC pool + balanced-read request. Conclusion / next step This is a real regression (or misconfiguration) in the EC split-replica-read optimization in the combined PR set (71182 / 70958 / 70556 / 69047), where reads on an optimized-EC pool with OPERATION_BALANCE_READS are no longer being split at the objecter. The owner of the EC-optimizations PR in that batch should look at why the objecter stopped taking the split path for the (fast_ec, split_ops) combination — likely a gating change around osd_min_split_replica_read_size / balanced-read handling. It is independent of your crimson watch/notify work.

Thankyou for the update. Yes - I agree this looks related. I expect we are blocking direct reads, but continuing to test them.

I will see if I can recreate and fix.

@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from 1cd08d7 to c165e73 Compare September 7, 2026 09:28
@aainscow
aainscow requested a review from a team as a code owner September 7, 2026 09:28
@github-actions github-actions Bot added the nvmeof label Sep 7, 2026
@aainscow
aainscow force-pushed the block_balance_reads_on_dedupe_tiering branch from c165e73 to f0e14a5 Compare September 7, 2026 10:15
…ols in _calc_target

Tiering and dedupe pools rely on read operations being directed to the
primary OSD so that overlay and redirect logic can be applied correctly.
When a global replica-read policy (e.g. rados_replica_read_policy=balance
or rados_replica_read_policy=localize) is configured, the CEPH_OSD_FLAG_BALANCE_READS
and CEPH_OSD_FLAG_LOCALIZE_READS flags were unconditionally set on every
outgoing op.  For pools that are a tier, have tiers, or have a dedup tier
configured, sending ops to a non-primary OSD bypasses the overlay/redirect
processing that those features depend on, leading to silent data
mis-direction or incorrect reads.  The same problem affected SplitOp: a
split op issued against a tiered or deduped pool could be routed to a
replica that has no knowledge of the tier relationship.

Introduce pool_t::allows_nonprimary_reads() which returns true only when
the pool is not a tier, does not have tiers, and has no dedup tier.  In
Objecter::_calc_target() the balanced/localized read flags are stripped
from the op flags whenever the target pool does not allow non-primary
reads.  In SplitOp::create() the same predicate is used to reject split
ops early, avoiding an invalid replica-targeted split on a pool that
requires primary-only reads.  This ensures that the global replica-read
policy never overrides the correctness requirements of tiering and dedupe.

Assisted-by: IBM Bob v2.1.0
Signed-off-by: Alex Ainscow <[email protected]>
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath17-testing-20260910.230809-main.

@ronen-fr

Copy link
Copy Markdown
Contributor

@ronen-fr ronen-fr removed the needs-qa label Sep 17, 2026
@SrinivasaBharath
SrinivasaBharath merged commit a02a740 into ceph:main Sep 18, 2026
16 checks passed
@aainscow aainscow added the no-backport-required Label that can be optionally added to show that we do not need to backport. label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core no-backport-required Label that can be optionally added to show that we do not need to backport. nvmeof Rados-Tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants