Uh oh!
There was an error while loading. Please reload this page.
Support IPv6 node URLs and filter wildcard redirect endpoints - #21
Merged
Conversation
parseNodeUrls split each node URL on ":" and required exactly two parts, so an IPv6 endpoint such as "[::1]:6667" was rejected up front with "Invalid nodeUrl format", making the client unusable with IPv6 nodes. Parse the bracketed [ipv6]:port form (consistent with apache/iotdb#18162), keeping IPv4 and hostname parsing unchanged; a bare (unbracketed) IPv6 address remains rejected as ambiguous. Also ignore a server redirect recommendation whose address is a wildcard/listen-all address (0.0.0.0 / ::): the endpoint set from the server's redirectNode is consumed by Session.getAndClearLastRedirect() and then cached and connected to by the pool, so the guard is applied there. Add tests for both. Signed-off-by: Zihan Dai <99155080+PDGGK@users.noreply.github.com>
HTHou
reviewed
Jul 24, 2026
HTHou
left a comment
Contributor
There was a problem hiding this comment.
One endpoint-parsing issue to address.
Uh oh!
There was an error while loading. Please reload this page.
parseNodeUrl used parseInt, which accepts a numeric prefix, so "[::1]:6667junk" and "[::1]:6667:9999" were silently parsed as port 6667. The port must now be an all-digits string before conversion. Adds regression tests for the bracketed, hostname and IPv4 forms. Addresses review feedback on apache#21. Signed-off-by: Zihan Dai <99155080+PDGGK@users.noreply.github.com>
PDGGK
commented
Jul 24, 2026
ContributorAuthor
Thanks @HTHou — you're right, |
HTHou
approved these changes
Jul 24, 2026
CritasWang
approved these changes
Jul 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Problem
parseNodeUrlssplits each node URL on:and requires exactly two parts, so an IPv6 endpoint such as[::1]:6667is rejected up front with "Invalid nodeUrl format", making the client unusable with IPv6 nodes. Separately, on the redirect path the client caches and connects to whatever endpoint the server advertises in aredirectNode, with no guard against a wildcard/listen-all address.Fix
Following the same approach as apache/iotdb#18162:
[ipv6]:portform by stripping the brackets and reading the port after them, keeping IPv4 and hostname parsing unchanged. A bare (unbracketed) IPv6 address with a port is ambiguous and rejected; the[ipv6]:portform must be used.redirectNodeis stored inSession.lastRedirectEndpointand later cached and connected to by the pool viagetAndClearLastRedirect(). That consumption point now ignores a redirect whose address is a wildcard/listen-all address (0.0.0.0,::), which is not a connectable remote endpoint — the current endpoint is kept.Tests
parseNodeUrls: bracketed IPv6 ([::1]:6667,[2001:db8::1]:6668) and malformed inputs (bare IPv6, unbalanced bracket, missing colon, empty port).isWildcardAddress, andSession.getAndClearLastRedirecton the real path: a wildcard redirect endpoint is dropped, a normal one passes through.[::1]loopback address; live IPv6-loopback connection tests (as in #18162) would need an IPv6-capable CI/test server, which I'm happy to add as a follow-up if the client CI supports it.Existing tests and
tscpass. Follows the dev@ "[DISCUSS] Improve IPv6 endpoint support" thread; one focused PR per client as @HTHou suggested.