Fix leaf node advertisement with no_advertise - #8451
Conversation
Signed-off-by: freakes <ISergey2022@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38e115330f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if !opts.LeafNode.NoAdvertise { | ||
| s.leafURLsMap[s.leafNodeInfo.IP]++ | ||
| } |
There was a problem hiding this comment.
Clear discovered leaf URLs when advertisements become empty
When leafnodes.no_advertise suppresses the server's own URL, leafURLsMap can now legitimately become empty after the last routed server that advertised a leaf URL disconnects. removeLeafNodeURL will send an async INFO with no leafnode_urls, but soliciting leaves only refresh discovered URLs when the incoming INFO has a non-empty URL list, so they keep stale discovered peers instead of falling back to the configured remote. In a no-advertise hub cluster, this leaves leaf nodes reconnecting to removed peers; empty async advertisements need to be applied as the current URL set too.
Useful? React with 👍 / 👎.
Summary
Respect
leafnodes.no_advertisewhen advertising leaf-node listener URLs.Previously, the server always added its own leaf listener address to the
advertised leaf-node URL set. As a result, connected leaf nodes could learn
the hub address and later try to reconnect to it even when
no_advertisewas enabled.
Avoid adding the local leaf listener URL when
no_advertiseis set.This also means a legitimate initial leaf INFO may contain no
LeafNodeURLs. Update the solicited leaf handshake validation so anInfoOnConnectINFO without advertised leaf URLs is not incorrectlyclassified as a wrong-port connection.
Tests
Added regression coverage for:
leafnodes.no_advertise=truenot leaking its leaflistener into the leaf's reconnect URL set
InfoOnConnectleaf INFO withoutLeafNodeURLsVerified with:
Resolves #8367