Defaults: one node at a time on a fresh store #482

Merged
jcoffey-dev merged 1 commits from fix/436-defaults-lease into main 2026-11-19 17:08:05 +00:00
1 Commits
Author SHA1 Message Date
jcoffey-dev 3e6300f802 Defaults: one node at a time on a fresh store (#436)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 11m49s
Every normal start adds what the store is missing, each as "none of
these yet, so insert them". Two nodes starting together on a freshly
bootstrapped store both did that at once. The second could find some of
the seven default listeners already written by the first, take the set
as complete and come up without the rest: in the Kubernetes lab, every
listener but http, the last one, so the node answered nothing on 8080.
The default roles and the Authentication record could be stored twice
the same way.

The normal-mode defaults now run under a short lease in the store
(`_` key "Bl", under the first boot defaults' letter), taken with a
compare-and-swap like the store layout lease: 60 seconds, renewed every
15 while held, released when done. A node that finds it held waits until
it's released, or runs out because its holder stopped, then checks the
store itself, which by then has everything. Bootstrap and recovery mode
are unchanged.

Test: tests/src/store/defaults_lease.rs: four tasks sharing one store
never hold the lease together; a live lease another node holds blocks;
one that ran out, or was released, is taken at once.
2026-11-19 09:29:21 -07:00