osd: Make recovery_pg_switch switch to the next PG #195

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:osd-recovery-pg-switch into master
Contributor

Description

pick_next_recovery never remembered which PG it took an object from, so recovery_last_pg.pg_num++ only advanced {0, N} and lower_bound() found the first PG again: since 998e24ad PGs are recovered one by one instead of switching every recovery_pg_switch operations. Since 019d644a the kind also rotates after every pick, and every kind without work resets the shared position.

Keep a separate position for each recovery kind, remember the PG on every pick, scan the next PG from its first object, skip a backfillfull pool from its first PG, and rescan the kind from the beginning when nothing is found after the position.

On master 884727af, 16 PGs × 128 objects, recovery_pg_switch 32: the longest run of recovery operations in one PG is 128, all of its objects; with the fix it is at most 32.

Based on a fix by Vitaliy Idelson.

Found: by reading the code after the chat question why recovery didn't interleave PGs, then reproduced with the new test.

Tested: tests/test_recovery_pg_switch.sh (fails on master, passes with the fix); test_recovery_enospc.sh, IMMEDIATE_COMMIT=1 test_rebalance_verify.sh, test_pg_chaos (100 seeds), osd_test.

Contributor Name

Yury Luneff (MIND Software LLC, https://mindsw.io)

CLA

### Description pick_next_recovery never remembered which PG it took an object from, so `recovery_last_pg.pg_num++` only advanced `{0, N}` and `lower_bound()` found the first PG again: since 998e24ad PGs are recovered one by one instead of switching every `recovery_pg_switch` operations. Since 019d644a the kind also rotates after every pick, and every kind without work resets the shared position. Keep a separate position for each recovery kind, remember the PG on every pick, scan the next PG from its first object, skip a backfillfull pool from its first PG, and rescan the kind from the beginning when nothing is found after the position. On master 884727af, 16 PGs × 128 objects, `recovery_pg_switch` 32: the longest run of recovery operations in one PG is 128, all of its objects; with the fix it is at most 32. Based on a fix by Vitaliy Idelson. Found: by reading the code after the chat question why recovery didn't interleave PGs, then reproduced with the new test. Tested: tests/test_recovery_pg_switch.sh (fails on master, passes with the fix); test_recovery_enospc.sh, IMMEDIATE_COMMIT=1 test_rebalance_verify.sh, test_pg_chaos (100 seeds), osd_test. ### Contributor Name Yury Luneff (MIND Software LLC, https://mindsw.io) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 1 commit 2026-11-26 15:04:20 +03:00
pick_next_recovery never remembered which PG it took an object from, so
recovery_last_pg.pg_num++ only advanced {0, N} and lower_bound() found the
first PG again: PGs were recovered one by one. Since the tombstone cleanup
the kind also rotates after every pick, and every kind without work reset
the shared position.

Keep a separate position for each recovery kind, remember the PG on every
pick, scan the next PG from its first object, skip a backfillfull pool
from its first PG, and rescan the kind from the beginning when nothing is
found after the position.

Based on a fix by Vitaliy Idelson.
This pull request has changes conflicting with the target branch.
  • src/osd/osd_flush.cpp
  • src/osd/osd_primary_sync.cpp
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u osd-recovery-pg-switch:koolkhel-osd-recovery-pg-switch
git checkout koolkhel-osd-recovery-pg-switch
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#195
No description provided.