osd: Wait for the old state lease to expire instead of exiting #140

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:osd-wait-old-lease into master

1 Commits

Author SHA1 Message Date
2edaa05bd0 osd: Wait for the old state lease to expire instead of exiting
An OSD killed with SIGKILL or by a power loss can't revoke its etcd
lease, so its /osd/state key stays until the lease expires. An OSD
restarted before that printed "OSD N is still up" and exited, to be
started again by systemd after one more full blockstore load. etcd also
gives every lease a full TTL again when its leader changes, so after a
power loss of the whole cluster most OSDs go through this, some of them
several times.

Check the state key before binding the sockets and acquiring the lease.
While it exists and has a lease, check it again every
etcd_quick_timeout (1 second by default). After 3 lease TTLs in total
go on as before: create_osd_state() then finds the key and exits,
because another OSD with this number really is up.

The OSD doesn't listen and holds no lease while it waits, so it accepts
no requests and writes nothing to etcd.
2026-11-22 16:51:04 +03:00