osd: don't let a timed-out PG state report overwrite a newer one #183

Open
koolkhel wants to merge 2 commits from koolkhel/vitastor:pg-state-stale-txn into master

2 Commits

Author SHA1 Message Date
4eae6646ee osd_test: return leases from the etcd mock, share the etcd key reader
The mock's range results had no lease, so the failed-report diagnostic
blamed the lease for every compare failure in tests. Return it as etcd
does, and read both PG keys in the tests through one helper.
2026-11-25 06:07:53 +03:00
c5ffe15b30 osd: don't let a timed-out PG state report overwrite a newer one
A PG state report that timed out on the client may still be applied by
etcd after the newer report sent by the retry, which goes to the next
etcd address. Its only compare, LEASE == ours, holds for every write of
this OSD, so the old txn put back an old state ("peering") or deleted
the key of an active PG, and the OSD never wrote it again: the PG stayed
"offline" or "peering" in etcd until the OSD was restarted.

Also require the state key to be unchanged since our last successful
write, like the /pg/history put already does, and print the state keys
that failed a compare.
2026-11-25 03:04:18 +03:00