Repository navigation
Fix ConfigNode client failover with stale candidates - #18847
Open
d-wang-commit wants to merge 1 commit into
Open
d-wang-commit wants to merge 1 commit into
d-wang-commit wants to merge 1 commit into
Conversation
d-wang-commit
marked this pull request as draft
October 13, 2026 07:04
Refresh candidates before fallback selection and resume after the current endpoint. Preserve candidates and cursor on empty refreshes. Add routing and connection tests and re-enable node status failover IT.
d-wang-commit
force-pushed
the
fix-confignode-client-failover
branch
from
October 15, 2026 15:52
3cc803e to
ab99b87
Compare
d-wang-commit
marked this pull request as ready for review
October 16, 2026 01:35
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
Recover from stale ConfigNode candidates
A pooled ConfigNode client created during startup can retain a seed-only address list after its DataNode has learned additional ConfigNode addresses. If the former leader remains reachable over TCP but returns
REDIRECTION_RECOMMENDwithout a redirect address, reconnecting to it can succeed repeatedly while the client continues using stale candidates.This change updates fallback selection in
AbstractConfigNodeClient:ConfigNodeInfobefore scanning fallback endpoints. This also covers RPC failures and connection failures to a cached leader.Re-enable all nine cases in
IoTDBNodeStatusFailoverITby reverting the temporary skip from 4541192. The original scenarios and timeouts are preserved.Tests
AbstractConfigNodeClientTest: 12 unit tests covering stale and reordered candidates, repeated redirects without a target, explicit redirects, removed and empty candidates, RPC and connection failures, bounded connection attempts, successful RPCs, and leader warm-up.AbstractConfigNodeClientConnectionTest: two unit tests covering connection pool reuse and closure, and concurrent reconnection with 100 clients using real loopback TCP connections. These verify client connection lifecycle rather than a 100-DataNode deployment.IoTDBNodeStatusFailoverIT; no new IT class was added.ConfigNodeInfoTest: 15 tests passed.IoTDBNodeStatusFailoverITcases and both existingIoTDBRemoveConfigNodeSchemaPartitionITcases: 11 tests passed. These include the live former-leader partition scenario and retrying after a ConfigNode returnsREDIRECTION_RECOMMENDwithout a redirect address.git diff --checkpassed.Side effects and risks
Entering fallback selection adds a local read-lock acquisition, candidate-list copy, and endpoint lookup, with work proportional to the number of ConfigNodes. Shared-list updates can contend with these reads. No discovery RPC, additional connection pool, protocol change, or configuration change is introduced.
Successful RPCs, explicit redirect priority, and known-leader warm-up behavior are preserved. Empty refreshes retain previously known addresses, which may themselves be stale.
The existing retry counter and backoff condition are unchanged; there is no additional refresh before the backoff check. A stale singleton list can therefore still trigger a two-second backoff before fallback selection refreshes the candidates. The counter does not track distinct endpoints, so this change does not guarantee that every candidate is tried before sleeping or that recovery completes within a fixed timeout.
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
AbstractConfigNodeClient: refresh candidates before fallback selection, resume after the last connected endpoint, and preserve candidates and cursor on empty refreshes.AbstractConfigNodeClientTest: verify candidate selection and retry behavior.AbstractConfigNodeClientConnectionTest: verify connection reuse and release during concurrent reconnects.IoTDBNodeStatusFailoverIT: restore all nine temporarily skipped integration tests.