test_pg_chaos: Check a recovered object only while nothing is in flight on it #210

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:pg-chaos-busy-recover into master
Contributor

Description

flush_recover_pending() read an object as soon as the PG was active again, even while a write to it was still in flight. A read racing a write may return a mixture of the old and the new data when the store writes the new version in place under it: store v1 flushes a stable small write into the clean block (v1/flush.cpp:529, 611) while a read planned before it is still reading that block, and the new store's compaction does the same (blockstore_flush.cpp:482). v1/read.cpp:441 states this outright: "Reads running parallel to flushes of the same clean block may read a mixture of old and new data". check_recovered() then reported content no recorded version explains ("came back from an outage holding content, which no world of the recorded versions explains").

The change leaves such objects pending; the convergence loop checks them after drain(), as it already does for repeated deletions. read_object() waits for its own read and starts nothing else, so busy[obj] == 0 means nothing is in flight under the check.

Found: by a chaos test, test_pg_chaos --seed 766023370 (replicated, fsync=0, csum none) on an older tree: a recovery read planned while a small write was in flight returned the previous version number with the new write's bytes at 24576.. and a hole at 8192, because compaction wrote the new version into the block before the read completed. Master takes another path for this seed and passes it.

Tested: the seed passes with the change on that tree; on master the default run (100 seeds) and seeds 1000000-1000299 give the same result with and without the change (all pass).

Contributor Name

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

CLA

### Description flush_recover_pending() read an object as soon as the PG was active again, even while a write to it was still in flight. A read racing a write may return a mixture of the old and the new data when the store writes the new version in place under it: store v1 flushes a stable small write into the clean block (v1/flush.cpp:529, 611) while a read planned before it is still reading that block, and the new store's compaction does the same (blockstore_flush.cpp:482). v1/read.cpp:441 states this outright: "Reads running parallel to flushes of the same clean block may read a mixture of old and new data". check_recovered() then reported content no recorded version explains ("came back from an outage holding content, which no world of the recorded versions explains"). The change leaves such objects pending; the convergence loop checks them after drain(), as it already does for repeated deletions. read_object() waits for its own read and starts nothing else, so busy[obj] == 0 means nothing is in flight under the check. Found: by a chaos test, test_pg_chaos --seed 766023370 (replicated, fsync=0, csum none) on an older tree: a recovery read planned while a small write was in flight returned the previous version number with the new write's bytes at 24576.. and a hole at 8192, because compaction wrote the new version into the block before the read completed. Master takes another path for this seed and passes it. Tested: the seed passes with the change on that tree; on master the default run (100 seeds) and seeds 1000000-1000299 give the same result with and without the change (all pass). ### 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-30 06:39:01 +03:00
flush_recover_pending() read an object as soon as the PG was active
again, even while a write to it was still in flight. A read racing a
write may return a mixture of the old and the new data when the store
writes the new version in place under it (store v1 flush, the new
store's compaction; see "Reads running parallel to flushes of the same
clean block may read a mixture of old and new data" in v1/read.cpp),
and check_recovered() then reported content no recorded version
explains. Leave such objects pending: the convergence loop checks them
after drain(), as it already does for repeated deletions.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u pg-chaos-busy-recover:koolkhel-pg-chaos-busy-recover
git checkout koolkhel-pg-chaos-busy-recover
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#210
No description provided.