Repository navigation
fix(health-check): reset backends marked DOWN when the health check is removed - #1814
Merged
Merged
Conversation
…s removed `RemoveHealthCheck` only dropped the cluster from `BackendMap::health_check_configs`: a backend a probe had marked DOWN stayed out of rotation with nothing left to probe it UP again, until the cluster was added again without a health check. `Server::remove_health_check_state` now clears the health check through `set_health_check_config(cluster_id, None)`, the path `AddCluster` already took, which resets every backend of the cluster to healthy and re-emits the availability gauges. An `AddCluster` upsert without a health check reset the backends but kept the cluster's in-flight probes, whose own config copy could mark a backend DOWN after the reset; it now drops them, as `RemoveHealthCheck` and `RemoveCluster` do. `RemoveCluster` removes the backends outright, and a master state replay reaches a fresh worker whose backends start healthy. Worker-level tests cover both clearing paths, and an e2e test removes the health check of a two-backend cluster after a probe marked one backend DOWN and checks that backend serves traffic again (two backends, since a cluster with every backend down fails open). doc/health_checks.md already described the reset; it now names the in-flight probes and the upsert path. Fixes #1811 Signed-off-by: Florentin Dubois <[email protected]>
…ve-resets-backends #1809 rewrote the `health-check remove` paragraph of doc/health_checks.md to describe the behaviour #1811 fixes; keep this branch's wording (backends reset to healthy, in-flight probes dropped) and drop the clause of #1809's CHANGELOG entry that documented the old behaviour. Signed-off-by: Florentin Dubois <[email protected]>
Signed-off-by: Florentin Dubois <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sozu cluster health-check removenow resets the backends a probe marked DOWN, asdoc/health_checks.mdalready states.Server::remove_health_check_stateonly dropped the cluster fromBackendMap::health_check_configs; it now goes throughBackendMap::set_health_check_config(cluster_id, None), the pathAddClustertakes, which resets every backend of the cluster to healthy and re-emits the availability gauges.Every path that clears a health check:
RemoveHealthCheck: fixed (drops in-flight probes, then resets the backends).AddClusterupsert withouthealth_check: already reset the backends, but kept in-flight probes, whose own config copy (record_check_resultusescheck.config) could mark a backend DOWN after the reset. It now drops them too.RemoveCluster: removes the backends outright; unchanged (the reset is a no-op on a removed cluster,record_cluster_availabilityreturns early).ConfigStateholds no backend health and a fresh worker starts with healthy backends; a replayedAddClusterinto a live worker takes the upsert path above.Tests
server::remove_health_check_tests::remove_health_check_resets_a_backend_marked_down: red without the fix (backend stays DOWN), green with it.server::remove_health_check_tests::add_cluster_without_health_check_resets_a_backend_marked_down: guard for the upsert path, which already reset; red when theset_health_check_configcall is removed fromServer::add_cluster.health_check_mode_tests::test_remove_health_check_restores_down_backend: two backends, one answering 404 on the probe path but 200 on traffic; waits until it is DOWN (health_check.down == 1) and excluded (10 consecutive requests to the other backend), sendsRemoveHealthCheck, then requires a response from it. Two backends because a cluster with every backend down fails open. Without the fix:the backend marked DOWN never served traffic after RemoveHealthCheck; with it: ok.Validation:
cargo +nightly fmt --check,cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings,cargo +1.93.1 test -p sozu-lib --lib --all-features --locked(1588 passed), the 11health_checke2e tests, the full e2e suite (--features opentelemetry,splice,simd -- --test-threads=4: 622 passed),check_doc_citations.py --base origin/main.Interplay with #1809
#1809 (merged) rewrote the
health-check removeparagraph ofdoc/health_checks.mdto describe the behaviour this PR fixes. The merge of origin/main keeps this PR's wording (backends reset to healthy, in-flight probes dropped) and drops the clause of #1809's CHANGELOG entry that documented the old behaviour.Fixes #1811