Repository navigation
DHCP slice 8a: mirror leases through the cluster heartbeat - #637
Conversation
Slice 8a of the DHCP design (docs/design/dhcp.md §3). A replica sends the primary its own leases written since the primary last said it held them, at most 500 a beat, with the highest sequence it holds of every node. The primary mirrors them, keeping the owner's sequence number, and answers on the sync response with the other nodes' leases the replica lacks. A row that names any node but the sender is dropped. The mirror is advertised by the primary (lease_protocol) and carried only to one that advertised it, since a primary refuses heartbeat fields it does not know. A node whose database was wiped or restored raises its counter past what the primary holds of it and renumbers its rows, so no number is used twice and its new leases aren't passed over as older than the mirrors. Enabling DHCP on a cluster is still refused; replicas serving their pinned ranges is slice 8b.
…unter A heartbeat's lease rows keep what the client sent, so 500 of them can pass the 1 MiB heartbeat limit and the primary refuses every beat (F54). Cut the batch at 256 KiB of JSON, keeping at least one row. A primary rebuilt from a backup counts again from 0 while the replicas hold its higher sequence numbers, so its new leases never reach them (F55). Raise its counter past what each report says the sender holds, as a wiped replica already does.
|
Review of #637 (slice 8a, lease mirror) at b7fd3ca: approve with changes, two low findings. Run on two real nodes (the #638 head, which carries this commit), each in its own network namespace on one bridge, port 67, real clients:
Findings:
Not filed:
|
What changed
#637 at 5da63dc only renames Blake's two review tests from zz_ to review_ over the Prover-passed fc73931; F54/F55 still pass and the review tests run green.
Red, then green
export PATH=/usr/local/go/bin:$PATH GOEXPERIMENT=jsonv2 SABLE_TEST_POSTGRES_DSN='postgres://postgres:sable@127.0.0.1:55432/postgres?sslmode=disable'; go test -count=1 -run 'Lease' ./internal/cluster/ && go test -count=1 -run 'DHCPLeaseMirror|DHCPLeaseHeld|DHCPLeaseRaiseSeq' ./internal/store/ && go test -count=1 -run 'TestDHCPLeaseCrossesTheMirrorWhole' ./internal/app/Checks
cd /home/peak/work/dhcp-server-for-sable/sable-8a && export PATH=/usr/local/go/bin:$PATH GOEXPERIMENT=jsonv2 SABLE_TEST_POSTGRES_DSN='postgres://postgres:sable@127.0.0.1:55432/postgres?sslmode=disable'; go test -count=1 -race -run 'Lease' ./internal/cluster/ && go test -count=1 -run 'DHCPLeaseMirror|DHCPLeaseHeld|DHCPLeaseRaiseSeq' ./internal/store/ && go test -count=1 -run 'TestDHCPLeaseCrossesTheMirrorWhole' ./internal/app/, exit 0cd /home/peak/work/dhcp-server-for-sable/sable/../out/review-638 && export PATH=/usr/local/go/bin:$PATH GOEXPERIMENT=jsonv2 SABLE_TEST_POSTGRES_DSN='postgres://postgres:sable@127.0.0.1:55432/postgres?sslmode=disable'; ./finding.sh 637 TestReview637LeaseBatchFitsTheHeartbeat zz_review637_heartbeat_size_test.go internal/cluster && ./finding.sh 637 TestReview637RebuiltPrimaryLeasesReachTheReplica zz_review637_rebuilt_primary_test.go internal/cluster && cd /tmp/pv8a && go test -count=1 -race -run 'Lease' ./internal/cluster/ && go test -count=1 -run 'DHCPLeaseMirror|DHCPLeaseHeld|DHCPLeaseRaiseSeq' ./internal/store/ && go test -count=1 -run TestDHCPLeaseCrossesTheMirrorWhole ./internal/app/, exit 0cd /tmp/pvx2 && export PATH=/usr/local/go/bin:$PATH GOEXPERIMENT=jsonv2 SABLE_TEST_POSTGRES_DSN='postgres://postgres:sable@127.0.0.1:55432/postgres?sslmode=disable'; go test -count=1 -race -run 'Lease|Review637' ./internal/cluster/ && go test -count=1 -run 'DHCPLeaseMirror|DHCPLeaseHeld|DHCPLeaseRaiseSeq' ./internal/store/ && go test -count=1 -run TestDHCPLeaseCrossesTheMirrorWhole ./internal/app/, exit 0Found and fixed
Risks
No code change since the last pass; live cluster runs were Blake's two-node harness, not production.
Prover
Passed (Sonnet): At 5da63dc (a pure rename of the two review tests over fc73931) I reran the cluster tests with -race including the F54/F55 review tests, the SQLite and Postgres store tests and the app mirror test, and gofmt is clean. Untested: two real nodes, version upgrade, full verify.
Every command above was run by Fortysix's Basecamp itself, on the branch named.