[KYUUBI #7712] Support IPv6 host:port parsing in Kyuubi service discovery - #7713
Open
maomaodev wants to merge 3 commits into
Open
[KYUUBI #7712] Support IPv6 host:port parsing in Kyuubi service discovery#7713maomaodev wants to merge 3 commits into
host:port parsing in Kyuubi service discovery#7713maomaodev wants to merge 3 commits into
Conversation
pan3793
reviewed
Sep 4, 2026
pan3793
reviewed
Sep 4, 2026
pan3793
reviewed
Sep 4, 2026
pan3793
left a comment
Member
There was a problem hiding this comment.
Please prefix the title with [KYUUBI #7712].
A few more places have the same issue and should be fixed in this PR:
kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scalaL319: whenkyuubi.ha.zookeeper.publish.configs=true, an IPv6 instance is split on the first colon and publishes a broken host/port. Please useIPStackUtils.getHostAndPorttoo.kyuubi-server/src/main/scala/org/apache/kyuubi/server/ui/JettyServer.scalaL59:getServerUri(and theadvertisedHostbranch inKyuubiRestFrontendService.connectionUrl) emits unbracketed IPv6, which breaks the batchkyuubiInstance/InternalRestClientpath in IPv6-only clusters. Please fix these withIPStackUtilsas well.kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.javaL409 (also L422, L536): authority strings concatenate host without brackets, so the rewrittenjdbcUriStringis malformed for IPv6. Please useIPStackUtils.formatIPAddressForURLwhen building them.
| IPStackUtils.HostPort hostPort = IPStackUtils.getHostAndPort(dataStr); | ||
| connParams.setHost(hostPort.getHostname()); | ||
| connParams.setPort(hostPort.getPort()); | ||
| } catch (Exception e) { |
Member
There was a problem hiding this comment.
getHostAndPort throws IllegalArgumentException only, catch it instead of Exception.
| } | ||
|
|
||
| host + ":" + actualPort | ||
| IPStackUtils.formatIPAddressForURL(host) + ":" + actualPort |
Member
There was a problem hiding this comment.
Port Hive's concatHostPort and use it here, it also validates host and port.
host:port parsing in Kyuubi service discoveryhost:port parsing in Kyuubi service discovery
pan3793
approved these changes
Sep 4, 2026
Contributor
Author
|
@pan3793 Good catch! Fixed all three, and swept the codebase for the same pattern. Your three:
Also fixed (same bug elsewhere):
Related:
Intentionally left alone (all non-functional, happy to revisit if you disagree):
|
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.
Why are the changes needed?
Fix #7712. Kyuubi currently cannot discover or connect to server/engine endpoints in IPv6-only clusters. Both the server side (
DiscoveryClient.parseInstanceHostPort) and the standalone JDBC client side (ZooKeeperHiveClientHelper) parse ahost:portstring by naively splitting on":". This breaks for IPv6 because IPv6 addresses themselves contain:.The correct parsing behavior already exists upstream in Hive (
org.apache.hadoop.hive.common.IPStackUtils). This patch mirrors that logic in a new lightweightIPStackUtilsutility underkyuubi-util, so it can be shared between the server side and the standalone JDBC client (which only depends onkyuubi-util).How was this patch tested?
IPStackUtilsTest(11 test cases) aligned with Hive's own IPStackUtilsTest, covering IPv4, IPv6 with brackets, IPv6 without brackets, hostname, invalid port, missing port, missing host and port range validation.DiscoveryClientSuitewith IPv6 cases (with and without brackets) and converted it from an orphan trait to a runnable class.Was this patch assisted by generative AI tooling?
Assisted-by: DeepSeek-V4-Pro