Bug #79493
openverify_upmap falsely rejects all upmaps for multi-take rules with device classes
0%
Description
CrushWrapper::verify_upmap() checks every choose/chooseleaf step of a rule against
the whole `up` vector, not against the part of it that the step's take..emit scope
actually produced. It also resolves each OSD's failure domain parent by searching
all of the rule's take subtrees, which includes the per-class shadow trees.
With a single take neither of these matters. With more than one take, both break,
and the documented hybrid layout (primary on ssd, replicas on hdd) is exactly that
case:
rule hybrid {
type replicated
step take default class ssd
step choose firstn 2 type zone
step chooseleaf firstn 1 type host
step emit
step take default class hdd
step choose firstn 2 type zone
step chooseleaf firstn 1 type host
step emit
}
Even a mapping that is exactly what this rule produces - one ssd and one hdd per
zone - fails verification. The zone parents of all four OSDs are counted against
the first "choose firstn 2 type zone" step, and since the parents come out of the
per-class shadow buckets, the two physical zones look like four distinct ones
(dc1~ssd, dc2~ssd, dc1~hdd, dc2~hdd):
verify_upmap number of buckets 4 exceeds desired 2 verify_upmap of pg 2.3 returning -22
So on any pool using such a rule:
- `ceph osd pg-upmap-items` is accepted by the CLI and then silently dropped by the
mon on the next osdmap update (OSDMap::check_pg_upmaps).
- the upmap balancer can never do anything, because every candidate goes through the
same verify_upmap call in calc_pg_upmaps (legal_swap). upmap_max_deviation makes no
difference.
How we ran into it: 462-OSD rook cluster, squid 19.2.x, two zones. An ssd node went
down and the PGs of a large hybrid-rule pool were remapped within the surviving zone.
That pool has about 3 PGs per OSD and roughly 250 GiB per PG replica, so a handful of
OSDs went to 85-90% (one crossed backfillfull and a degraded PG got stuck in
backfill_toofull) while same-zone peers were sitting at 25%. Hand-written
pg-upmap-items entries - CRUSH-valid replacements inside the same class and zone -
were cancelled immediately. The balancer, with upmap_max_deviation=1 and a measured
per-OSD PG count deviation of +5 on that pool, kept saying "Optimization plan created
successfully" with an empty plan. In the end only `ceph osd reweight` and pg_num
changes were of any use.
Someone on ceph-users hit what looks like the same false rejection back in 2019, no
follow-up:
https://lists.ceph.io/hyperkitty/list/[email protected]/thread/HKCZIVLITLOSQJCIJF646GYZKVK6HWTH/
Not the same as https://tracker.ceph.com/issues/51729, which is a different false
rejection in this function (inner choose steps inside one take..emit scope, where the
numrep of an inner step is per outer result). The fix proposed there,
https://github.com/ceph/ceph/pull/69151, does not help with this: with it applied the
reproducer above still fails, because the zone step's allowance stays at 2 while four
shadow buckets are counted. It holds the other way round as well - with my patch
applied, the rule shape from #51729 is still rejected exactly as it was before (I ran
the exact shape and a set of permutations through both versions and the verdicts are
identical), so the two fixes do not overlap.
Fix I'm about to send as a PR: move the choose/chooseleaf checks to EMIT, where the
scope's segment of `up` is known - the EMIT handler already computes that segment
length for its subtree containment check. Then check only the OSDs of that segment,
and resolve parents inside the current take subtree only. Single-take rules behave
exactly as before, and the set of rejected mappings only shrinks, so nothing stored
can flip from accepted to rejected on upgrade.
Affected: everything since upmap and device classes landed (luminous). Still present
on current main.
WK Updated by woojoong kim 4 months ago
- Pull request ID set to 71053
LF Updated by Laura Flores 4 months ago
On my list to review
RZ Updated by Radoslaw Zarzynski 3 months ago ยท Edited
Bump up (CC @Laura Flores).
LF Updated by Laura Flores 3 months ago
On my list to review.
RZ Updated by Radoslaw Zarzynski 3 months ago
Needs review.
LF Updated by Laura Flores 3 months ago
Bump up; needs reviews.
LF Updated by Laura Flores 2 months ago
Bump up; on my list to review.
LF Updated by Laura Flores 2 months ago
- Status changed from New to Fix Under Review
Review in progress.
LF Updated by Laura Flores about 2 months ago
Bump up
LF Updated by Laura Flores about 2 months ago
Bump up; still on my TOREVIEW.
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
needs rebase and review
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
needs review
LF Updated by Laura Flores about 1 month ago
Bump up (needs review)
RZ Updated by Radoslaw Zarzynski 28 days ago
Bump up.
LF Updated by Laura Flores 21 days ago
Bump up (sorry, still intend to review this)