Store v1: Fix three journal replay bugs #157

Open
koolkhel wants to merge 4 commits from koolkhel/vitastor:v1-replay-fixes into master

4 Commits

Author SHA1 Message Date
Yury Luneff
8e03e581ff Store v1: Test that a new journal does not chain to an old one
Preparing an OSD again zeroes only the first block of its journal, so
the sectors of the previous OSD stay behind it. A start entry that is
the same every time would let the replay chain into them; the random
version of the start entry is what prevents it.
2026-11-23 09:36:40 +03:00
Yury Luneff
2cfd9ab240 Store v1: Do not replay an earlier pass of the journal (test_blockstore_chaos --seed 350 --config 21 --steps 30000 --p-delete 30)
A trim can point the superblock at a sector whose latest write is not
durable yet, or not written at all when the journal is emptied. That
sector then holds an earlier pass of the ring, and replay, which never
checked the first entry, took it for live entries: old deletions and
writes came back over renumbered objects. Keep what the first entry
chains to in the superblock's reserved field and stop the replay, in the
store and in vitastor-disk, on a mismatch (0 from older versions skips the
check). Never trim past a sector still open for appends.
2026-11-23 09:36:40 +03:00
Yury Luneff
94227e9a67 Store v1: Keep journaled small writes under a deletion (test_blockstore_chaos --seed 553 --config 22 --steps 30000 --p-delete 30)
A deletion forgot every unsynced version before it, small writes too.
Their entries are already in the journal and may reach the disk with
any later fsync, yet forgetting them released their sectors, so a trim
could cut between an object's small writes while the deletion was not
durable: after a power outage recovery replayed the later ones without
their base. Forget only unsynced big writes, which are not journaled yet.
2026-11-23 09:36:40 +03:00
Yury Luneff
d9289b8bbb Store v1: Start each instance with a journal entry of its own (test_blockstore_chaos --seed 61 --config 14 --steps 30000 --p-delete 30)
Journal entries chain only by checksums. After a power outage left a
hole with written sectors behind it, the same entries written into the
hole again (a retried write, delete or stabilize) made those sectors a
valid continuation, and the next restart replayed lost operations.
Write a no-op rollback of the absent object 0:0 to a random version at
start, so nothing written later matches what a crashed instance wrote.
2026-11-23 09:36:40 +03:00