Bug #67265
closedMake sure *pgupmap* entries are removed when changing number of pgs per pool
0%
Description
I am not sure if this is tracked for the capacity balancer, it is probably not tracked for the read balancer.
Apart from not being effective after pg num change, if you reduce the number of pgs per pool it may leave orphan entries which can't be removed by the rm-pgupmap-* commands.
JS Updated by Josh Salomon over 2 years ago
- Related to Bug #67179: Make rm-pg-upmap-primary able to remove mappings by force added
RZ Updated by Radoslaw Zarzynski over 2 years ago
- Priority changed from Normal to High
LF Updated by Laura Flores over 2 years ago
- Status changed from New to In Progress
- Pull request ID set to 59331
LF Updated by Laura Flores over 2 years ago · Edited
Related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2302230 (see BZ for problem description).
Short summary: PGs are getting stuck scaling down post removal of bulk flag on the cluster.
After looking into this issue, I have found the problem to be with the pg count adjustment logic in the daemon server code. The daemon server periodically adjusts pg count based on a series of conditions, including pg merging. After setting up a reproduction environment, I enabled higher logging on the mgr, which allowed me to see that while `pg-upmap` and `pg-upmap-items` entries are removed for pgs that are pending merge, `pg-upmap-primary` mappings are not. This leads to the daemon server identifying a mismatch in the acting set between the source and the target, then deferring the pg adjustment update.
Like in the BZ’s original problem description, I observed in my reproduction environment that the pg scale-down process gets stuck at the surface. A deeper look in the mgr log (with debug_mgr=10) shows that the daemon server identifies that the current acting set doesn’t match the original acting set and simply defers until the next pg adjustment. In my local environment, I observed that removing each `pg-upmap-primary` mapping in the affected pool (`ceph osd rm-pg-upmap-primary <pgid>`) helped the cluster unstick, and the pg scale-down process resumed.
The above can be considered a workaround, but the missing daemon server logic will be addressed. We already identified the issue here that `pg-upmap-primary` mappings are not properly removed when pg_num is reduced. This bulk flag scenario is related and will be solved in the same pull request.
The fix will involve removing the `pg-upmap-primary` entries for pgs that are merge candidates, like pg-upmap-items and pg-upmap.
@Pawan Dhiran, please confirm whether the workaround, removing the primary mappings on the affected pool, helps your cluster unstick.
Steps to reproduce:
1. Set up a vstart cluster with 7 OSDs (can do more, but when I did 9 like the original issue, I ran out of space):
OSD=7 ../src/vstart.sh --debug --new -x --localhost --bluestore
$ ./bin/ceph -s
cluster:
id: 6b820a95-d239-4b46-877a-f919eab99c0b
health: HEALTH_OK
services:
mon: 3 daemons, quorum a,b,c (age 10m)
mgr: x(active, since 10m)
mds: 1/1 daemons up, 2 standby
osd: 7 osds: 7 up (since 9m), 7 in (since 9m)
data:
volumes: 1/1 healthy
pools: 5 pools, 337 pgs
objects: 24 objects, 451 KiB
usage: 7.0 GiB used, 700 GiB / 707 GiB avail
pgs: 337 active+clean
2. Set min-compat-client:
$ ./bin/ceph osd set-require-min-compat-client reef
3. Set upmap-read mode:
$ ./bin/ceph balancer mode upmap-read
4. Set mgr debug to 10:
$ ./bin/ceph config set mgr.* debug_mgr 10
5. Create a test replicated pool:
$ ./bin/ceph osd pool create balancer_test_pool $ ./bin/ceph osd pool application enable balancer_test_pool rados
6. Write some data to balancer_test_pool:
$ ./bin/rados -p balancer_test_pool bench 10 -b 4096 write --no-cleanup
hints = 1
Maintaining 16 concurrent writes of 4096 bytes to objects of size 4096 for up to 10 seconds or 0 objects
Object prefix: benchmark_data_folio01_3831666
sec Cur ops started finished avg MB/s cur MB/s last lat(s) avg lat(s)
0 0 0 0 0 0 - 0
1 16 4976 4960 19.374 19.375 0.00376526 0.00321731
2 16 9988 9972 19.4752 19.5781 0.00257576 0.00320424
3 15 15030 15015 19.5493 19.6992 0.00238394 0.00319295
4 16 20100 20084 19.6117 19.8008 0.00284419 0.00318331
5 16 25171 25155 19.6508 19.8086 0.00279721 0.00317738
6 16 30435 30419 19.8024 20.5625 0.0026393 0.00315295
7 16 35698 35682 19.9102 20.5586 0.00388502 0.00313619
8 16 40955 40939 19.9881 20.5352 0.00307089 0.00312406
9 16 46320 46304 20.0955 20.957 0.00266266 0.00310735
10 10 51604 51594 20.1522 20.6641 0.00290463 0.00309872
Total time run: 10.0024
Total writes made: 51604
Write size: 4096
Object size: 4096
Bandwidth (MB/sec): 20.153
Stddev Bandwidth: 0.554801
Max bandwidth (MB/sec): 20.957
Min bandwidth (MB/sec): 19.375
Average IOPS: 5159
Stddev IOPS: 142.029
Max IOPS: 5365
Min IOPS: 4960
Average Latency(s): 0.00309862
Stddev Latency(s): 0.000561246
Max latency(s): 0.012245
Min latency(s): 0.0016216
7. Set the bulk flag; wait for the pg_num to increase to pgp_num_target:
$ ./bin/ceph osd pool set balancer_test_pool bulk true
$ ./bin/ceph osd pool ls detail pool 1 'rbd' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 32 pgp_num 32 autoscale_mode on last_change 51 lfor 0/0/47 flags hashpspool stripe_width 0 application rbd read_balance_score 1.31 pool 2 '.mgr' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 1 pgp_num 1 autoscale_mode on last_change 22 flags hashpspool stripe_width 0 pg_num_max 32 pg_num_min 1 application mgr read_balance_score 6.98 pool 3 'cephfs.a.meta' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 16 pgp_num 16 autoscale_mode on last_change 79 lfor 0/0/47 flags hashpspool stripe_width 0 pg_autoscale_bias 4 pg_num_min 16 recovery_priority 5 application cephfs read_balance_score 1.75 pool 4 'cephfs.a.data' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 256 pgp_num 256 autoscale_mode on last_change 55 lfor 0/0/53 flags hashpspool,bulk stripe_width 0 application cephfs read_balance_score 1.04 pool 5 'balancer_test_pool' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 128 pgp_num 128 autoscale_mode on last_change 268 lfor 0/0/101 flags hashpspool,bulk stripe_width 0 application rados read_balance_score 1.04 max_osd 7
8. Remove the bulk flag:
$ ./bin/ceph osd pool set balancer_test_pool bulk false
9. After a few minutes, observe that the pg count gets stuck (pg_num does not keep reducing to match pgp_num_target):
$ ./bin/ceph osd pool ls detail pool 1 'rbd' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 32 pgp_num 32 autoscale_mode on last_change 51 lfor 0/0/47 flags hashpspool stripe_width 0 application rbd read_balance_score 1.31 pool 2 '.mgr' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 1 pgp_num 1 autoscale_mode on last_change 22 flags hashpspool stripe_width 0 pg_num_max 32 pg_num_min 1 application mgr read_balance_score 6.98 pool 3 'cephfs.a.meta' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 16 pgp_num 16 autoscale_mode on last_change 79 lfor 0/0/47 flags hashpspool stripe_width 0 pg_autoscale_bias 4 pg_num_min 16 recovery_priority 5 application cephfs read_balance_score 1.75 pool 4 'cephfs.a.data' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 256 pgp_num 256 autoscale_mode on last_change 55 lfor 0/0/53 flags hashpspool,bulk stripe_width 0 application cephfs read_balance_score 1.04 pool 5 'balancer_test_pool' replicated size 3 min_size 1 crush_rule 0 object_hash rjenkins pg_num 125 pgp_num 117 pg_num_target 32 pgp_num_target 32 autoscale_mode on last_change 304 lfor 0/302/300 flags hashpspool stripe_width 0 application rados read_balance_score 1.18
9. Observe in the mgr log that the daemon server identifies a mismatch in the acting set on pg 5.3c:
2024-08-27T20:44:41.982+0000 7f9f6ad70640 20 mgr.server adjust_pgs 2024-08-27T20:44:41.982+0000 7f9f6ad70640 10 mgr.server operator() creating_or_unknown 0 max_creating 1024 left 1024 2024-08-27T20:44:41.982+0000 7f9f6ad70640 20 mgr.server operator() misplaced_ratio 0 degraded_ratio 0 inactive_pgs_ratio 0 unknown_pgs_ratio 0; target_max_misplaced_ratio 0.05 2024-08-27T20:44:41.982+0000 7f9f6ad70640 20 mgr.server operator() pool 5 pg_num 125 target 32 2024-08-27T20:44:41.982+0000 7f9f6ad70640 10 mgr.server operator() pool 5 pg_num_target 32 pg_num 125 - merge target 5.3c acting does not match (source [4,2,0] != target [0,2,4]) 2024-08-27T20:44:41.982+0000 7f9f6ad70640 20 mgr.server operator() pool 5 pgp_num_target 32 pgp_num 117 -> 32 2024-08-27T20:44:41.982+0000 7f9f6ad70640 20 mgr.server operator() room 0.025 estmax 3 delta 4294967211 next 114 2024-08-27T20:44:41.982+0000 7f9f6ad70640 10 mgr.server operator() using next 117 to avoid outpacing merges (max_outpace_merges 8) 2024-08-27T20:44:42.190+0000 7f9f67569640 10 monclient: tick
LF Updated by Laura Flores almost 2 years ago
- Backport set to squid,reef
LF Updated by Laura Flores almost 2 years ago
- Status changed from In Progress to Fix Under Review
- Pull request ID changed from 59331 to 62067
LF Updated by Laura Flores over 1 year ago
- Related to Bug #71988: rados/thrash: Assertion error: wait_for_recovery: failed before timeout expired due to "clean+premerge+peered" pgs added
LF Updated by Laura Flores 12 months ago
- Backport changed from squid,reef to tentacle,squid,reef
LF Updated by Laura Flores 10 months ago
PR was reworked; under review right now.
UB Updated by Upkeep Bot 10 months ago
- Status changed from Fix Under Review to Pending Backport
- Merge Commit set to be99f977ad86a802081003f7042ae693d020c7ef
- Fixed In set to v20.3.0-5331-gbe99f977ad
- Upkeep Timestamp set to 2026-02-15T15:19:50+00:00
UB Updated by Upkeep Bot 10 months ago
- Copied to Backport #74948: squid: Make sure *pgupmap* entries are removed when changing number of pgs per pool added
UB Updated by Upkeep Bot 10 months ago
- Copied to Backport #74949: tentacle: Make sure *pgupmap* entries are removed when changing number of pgs per pool added
UB Updated by Upkeep Bot 10 months ago
- Copied to Backport #74950: reef: Make sure *pgupmap* entries are removed when changing number of pgs per pool added
UB Updated by Upkeep Bot 10 months ago
- Tags (freeform) set to backport_processed
LF Updated by Laura Flores 7 months ago
- Related to Bug #76731: [Reads Balancer] PGs not getting scaled down post removal of bulk flag on the cluster added
LF Updated by Laura Flores 3 months ago
- Status changed from Pending Backport to Resolved
UB Updated by Upkeep Bot 3 months ago
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-02-15T15:19:50+00:00 to 2026-08-28T01:39:13+00:00
LF Updated by Laura Flores 2 months ago
- Related to Bug #74248: [Squid] MGR crash loop (Assertion Failure) in OSDMap::balance_primaries when enabling upmap_read with existing stale pg_upmap_primary entries added
UB Updated by Upkeep Bot about 1 month ago
- Released In set to v21.2.0~1255
- Upkeep Timestamp changed from 2026-08-28T01:39:13+00:00 to 2026-10-24T02:00:44+00:00