fix: DNS upstream healthcheck recreation with IP changes#12987
Closed
grapestore wants to merge 1 commit intoapache:masterfrom
Closed
fix: DNS upstream healthcheck recreation with IP changes#12987grapestore wants to merge 1 commit intoapache:masterfrom
grapestore wants to merge 1 commit intoapache:masterfrom
Conversation
Problem: When DNS resolution changes (test.com: 127.0.0.1 → 127.0.0.2), healthchecker was not being recreated, causing health checks to fail for DNS-based upstreams. Root Cause: - parse_domain_in_up() updated modifiedIndex with timestamp in memory - However, _nodes_ver remained nil in stored config - When fetch_checker calculated requested version: version = modifiedIndex (no timestamp) + _nodes_ver (nil) = no timestamp - When healthcheck_manager calculated current version: version = modifiedIndex (with timestamp) + _nodes_ver (nil) = with timestamp - Version mismatch prevented healthchecker creation Solution: 1. Keep modifiedIndex as original (no timestamp modification) 2. Set _nodes_ver with timestamp when IP changes: '#1770398721.88' 3. Persist to config: resource.set_nodes_ver_and_nodes() 4. Both places now calculate: modifiedIndex + _nodes_ver correctly Result: - requested_version: '53#1770398721.88' ✅ - current_version: '53#1770398721.88' ✅ - Versions match → healthchecker recreated on DNS IP change
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.
Description
This PR fixes an issue where the healthchecker was not created due to a version mismatch,
causing health checks for DNS-based upstreams to not work.
The mismatch occurred because
parse_domain_in_up()modifiedmodifiedIndexin memory,while
_nodes_verwas not persisted in the config.As a result,
fetch_checkerandhealthcheck_managercalculated different versions for the same upstream.How to reproduce
Both active and passive health checks do not work because the healthchecker is not created.
This PR ensures that:
modifiedIndexremains unchanged_nodes_veris set with a timestamp when nodes are updated_nodes_verand updated nodes are persisted to the configWith these changes, both components calculate the same version and the healthchecker is created correctly.
Which issue(s) this PR fixes:
Fixes #
Checklist