Repository navigation
Stop a replaced Corrosion after 1 s so an upgrade pauses ployzd ~1 s, not ~7 s - #3697
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Closes #3680.
Summary
When ployzd replaces its Corrosion container, it waits for the old one to stop before it starts the new one. A replacement happens on an image change at upgrade or downgrade, a config change, or when a kept container doesn't answer. ployzd stopped the old container with Docker's default 10 s grace. On SIGTERM, Corrosion's gossip endpoint waits up to 5 s for its QUIC connections to go idle, and peers keep them open. So every replacement waited the full 5 s, and ployzd isn't ready until the new Corrosion answers. #3680 measured ployzd down 6.0 to 7.0 s per upgrade step.
ployzd start CorrosionConfig::start ensure container: Replace - docker stop ployz-corrosion # default 10 s grace; Corrosion exits after ~5.1 s + docker stop -t 1 ployz-corrosion # SIGKILL 1 s after SIGTERM create + start new Corrosion wait ready # ployzd signals ready to systemd after thisManagedService::with_stop_gracesets Docker's per-stop timeout. Only Corrosion uses it; unregistry keeps Docker's default.cleanupon reset, andremove_retained.Nothing durable rides on Corrosion's graceful exit:
synchronous = "full"also covers power loss.Downgrade: a daemon at 0.3.11 or older stops a newer Corrosion with its own code and the default grace, so a downgrade that replaces Corrosion still pauses ~5 s. 0.3.12 and this head pin the same Corrosion image and config, so moving between them replaces nothing and doesn't pause.
Evidence
Boat
--cloudwith 3 Servers, enrolled on the checkout and then installed with the genuine v0.3.11 release (efb602dc). Each step rolled one Server while the other daemons kept running.revision= PR headdd0ef1430d. The running headployzdhashed82fe77fbc17b, the same as the run's checkout build.dashboard/.verify/run/sdk.log:sdk: hit github run 41214907435 (3add01b13afe). That is an exact key hit on this checkout's SDK sources; this PR changes only ployzd, which the SDK doesn't include. Nostale main@.redact: 0 leaks.Pause.
start→readyis ployzd's start to systemd READY, which comes after Corrosion answers. Old-Corrosion timings are fromdocker eventsonployz-corrosion, with SIGTERM at +0.#3680 measured 6.5 to 7.0 s for the same upgrade on 0.3.12, which is where the downgrade rows sit.
ployz exec(management path) lost 0 of 77,248 acks across all those steps. Its longest gap, 6.71 s, was the downgrade on the db host (old code). Head upgrades on the db host showed 3.34 s and 4.06 s, against Upgrading or downgrading a Server pauses its daemon ~7 s while the old Corrosion container takes ~5 s to stop #3680's 6.94 s. The probe's gap includes its ownployz execreconnect.Kill under write load (the coordinator's condition). A loop on each Server inserted numbered rows into the replicated
clustertable through its local Corrosion API. An id counted as acked only after the API answeredrows_affected: 1. While all three loops and the ack probe ran:docker kill -s KILLand 3×docker stop -t 1on Corrosion, on the db host and on a second Server. The keeper had it running again within 0.5 to 2.1 s each time.rows-agree.sh:rows agree on every Machine: 25073 rowsPRAGMA integrity_checkok×3ployz exec)Power cut under load (#3674's
scripts/verify/power-cut-replication.shon the db host: two cuts, the second 8 s after boot). The Corrosion load ran on every Server during it, plus a web Service with 3 replicas.machine-3 kept its Corrosion actor, and every proxy routed only In copies.rows agree on every Machine: 47653 rows. 22,138 acked writes, 0 lost on every Server,integrity_checkok×3.Not covered: each roll's other-daemon timestamps weren't recorded per step. The step helper touched only one Server's units.
Focused tests:
cargo test -p ployzd --lib -- managed_service corrosion::service: 16 passed.cargo clippy -p ployzd --all-targets -D warnings: clean.Review:
dd0ef1430d(Codex and Opus): CLEAN, no BUG-class finding.Design bets
Merge Danger
Door: two-way. Reverting restores the default grace; no data or format changes.
Blast Radius: Corrosion's lifecycle on every Server.
Every Corrosion replacement and reset now ends in SIGKILL. The kill and power-cut runs above show no lost acked writes and identical rows.