Resolve control node identity via system.local before initial metadata refresh#853
Merged
dkropachev merged 3 commits intoMar 27, 2026
Conversation
92752c0 to
4a40853
Compare
5209fd1 to
a1b3ceb
Compare
- Add port range validation in ClientRoutesConfig.withNativeTransportPort - Handle null metricUpdater in DefaultNode.setEndPoint (transient field can be null on deserialized nodes) and clear old metrics on update - Close NlbSimulator discovery proxy when all nodes are removed - Handle empty targets list in RoundRobinProxy to avoid division by zero - Rename savePort test to reflect actual behavior
Contact point nodes are ephemeral objects used only for the connection query plan. They don't need metrics registration, which avoids unnecessary metric churn during initialization and reconnection. - Add DefaultNode.newContactPoint() static factory that creates nodes with NoopNodeMetricUpdater instead of registering real metrics - Update MetadataManager.addContactPoints to use the factory - Update LoadBalancingPolicyWrapper to use the factory - Update TestNodeFactory to distinguish between full nodes (with metrics) and contact points (without)
a7ac61f to
ad36409
Compare
nikagra
reviewed
Mar 27, 2026
ad36409 to
e62adde
Compare
nikagra
approved these changes
Mar 27, 2026
nikagra
left a comment
There was a problem hiding this comment.
One clarifying comment suggestion, 👍 otherwise
4d41bd1 to
bafa36e
Compare
…a refresh Instead of carrying contact point nodes through to InitialNodeListRefresh and matching them by endpoint, the control connection now resolves the connected node's full identity (hostId, datacenter, rack, etc.) by querying system.local immediately after establishing the channel. The resolved node is registered into metadata via MetadataManager.registerNode before the initial node list refresh runs, so the refresh can find and reuse it by hostId — preserving connection state. Key changes: - TopologyMonitor: rename getChannelEndpoint to getChannelNodeInfo, returning full NodeInfo instead of just an EndPoint - ControlConnection: add controlNode() accessor; resolve contact point nodes via system.local and register them into metadata; track currentControlNode/pendingControlNode for event matching - MetadataManager: add registerNode() to atomically insert a node into metadata by hostId; remove contact points parameter from InitialNodeListRefresh - InitialNodeListRefresh: match discovered nodes against existing metadata entries by hostId instead of matching contact points by endpoint - Load balancing helpers: infer local DC from control connection (controlNode hostId or channel endpoint) instead of contact points; replace checkLocalDatacenterCompatibility with a warning when the configured DC doesn't match any node
bafa36e to
a6f116e
Compare
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.
Summary
Refactors how contact points transition into metadata nodes:
system.localviagetChannelNodeInfo()and registers the node into metadata (MetadataManager.registerNode()) beforeInitialNodeListRefreshruns.MetadataManager.registerNode(): Atomically creates and inserts a metadata node fromNodeInfoon the admin executor, preventing races with concurrent metadata refreshes.controlNode()accessor andisControlNode()method match by hostId instead of endpoint comparison, fixing false matches behind NLB/proxy where multiple nodes share the same endpoint.OptionalLocalDcHelper,MandatoryLocalDcHelper,InferringLocalDcHelper) infer the local DC from the control connection node instead of contact points, removingwasImplicitContactPoint()and contact-point DC checks.DefaultNode.newContactPoint()creates nodes withNoopNodeMetricUpdatersince contact points are temporary objects replaced by real metadata nodes.getChannelEndpoint()renamed togetChannelNodeInfo(), returning fullNodeInfoinstead of justEndPoint.RoundRobinProxy, NlbSimulator cleanup when all nodes removed.Test plan
ControlConnectionTest,InitialNodeListRefreshTest,MetadataManagerTest, LBP init/distance testsregisterNodeidempotency, contact-point-to-metadata-node resolutionConnectIT(DC inference from control connection, LBP init failure cleanup),NodeStateIT(event expectations for new node lifecycle)