yackushevas opened a new pull request, #70572:
URL: https://github.com/apache/doris/pull/70572

   [feature](cloud) Support IPv6 binding in meta-service
   
   ### Background
   
   doris_cloud selects its address via priority_networks and starts a brpc 
server. cloud/src/common/network_util.cpp is IPv4-only: CIDR is built on 
inet_aton/uint32_t, InetAddress wraps sockaddr_in, get_hosts_v4() collects 
AF_INET only, and the brpc server binds the implicit 0.0.0.0 wildcard.
   
   ### What problem does this PR solve?
   
   Issue Number: close #66701
   Related PR: #14063 (added IPv6 to BE and FE, cloud was left IPv4-only)
   PR Type: Feature
   
   Problem Summary: an IPv6 priority_networks (e.g. ::/0 or fd00::/32) crashes 
doris_cloud at startup ("wrong cidr format"), and even with a valid config the 
meta service only binds 0.0.0.0, forcing dual-stack in IPv6-only environments. 
This PR ports the BE IPv6 implementation to cloud: IPv6 CIDR parsing, IPv6 
interface enumeration, family-aware local IP selection, "[v6]:port" endpoint 
formatting for the server registry, and [::0] brpc binding when IPv6 is 
selected. IPv4-only hosts behave exactly as before.
   
   ### Details
   
   - **Scope:** doris_cloud networking only (meta service, recycler); no FE/BE 
changes.
   - **Design:** CIDR and InetAddress are ported from 
be/src/util/{cidr.cpp,network_util.*}; get_local_ip() follows BE 
BackendOptions::analyze_localhost semantics — the priority CIDR family selects 
IPv4/IPv6, the config order breaks ties. get_host_port() (ported from the same 
PR #14063) brackets IPv6 literals in the service registry id and in 
notify_refresh_instance() endpoints, so brpc Channel::Init can dial IPv6 peers. 
The brpc starter binds get_service_bind_address() via butil::str2endpoint, as 
BE does.
   - **Usage:** priority_networks = fd00::/64
   - **Default behavior:** empty priority_networks keeps butil::my_ip_cstr() 
and binding 0.0.0.0.
   - **Compatibility:** the loopback fallback stays 127.0.0.1 on dual-stack 
hosts (IPv4 loopback preferred), so existing configs behave identically. ::1 
now counts as a loopback address for the enable_loopback_address_for_ms check, 
same as 127.0.0.1. The /0 mask is now accepted (BE behavior), which is what 
makes ::/0 usable.
   
   ### Testing
   
   - cloud/test/network_util_test.cpp: new GetLocalHostIPv6Test (::1/128 
selection, non-matching IPv6 CIDR fallback, bind-address family, get_host_port 
formatting).
   - The modified network_util.cpp was compiled standalone and executed against 
the live dual-stack interfaces of a host that carries ::1, fe80:: and a real 
fd00:1148::/64 ULA: 12/12 selection/bind-address/host-port cases passed, and 
8/8 CIDR edge cases rejected invalid input (mask >32/128, 
non-numeric/trailing-junk/empty mask, malformed IP) while ::/0 no longer 
crashes and selects an IPv6 address.
   - run-cloud-ut.sh on a Linux stand: in progress (blocked on third-party 
toolchain issues with a very fresh clang on the stand, unrelated to this 
change); CI will validate.
   - clang-format v16 / clang-tidy: not run locally yet (stand in progress).
   
   ### Notes for Reviewers
   
   A loopback address can now be selected directly by a priority CIDR (BE 
semantics); the returned string is unchanged (e.g. 127.0.0.1/8). The dead `else 
if (!priority_cidrs.empty())` branch in the selection loop is removed (empty 
priority_networks returns early). butil::str2endpoint("[::0]", port) is valid 
in brpc 1.4.0: ExtendedEndPoint::create parses the bracketed IPv6 form before 
the IPv4-only str2ip path.
   
   ### Release note
   
   doris_cloud (Meta Service / Recycler) supports IPv6: priority_networks 
accepts IPv6 CIDRs and the brpc server binds [::0] when an IPv6 address is 
selected, enabling IPv6-only storage-compute deployments without dual-stack 
workarounds.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details).
   - Does this need documentation: No (priority_networks semantics match the BE 
documentation).
   - Pre-submission status: Partially verified: standalone runtime verification 
passed as described in Testing; cloud UT and clang-format/clang-tidy are 
running on a Linux stand and CI.
   
   ### AI Disclosure
   
   - Tool: OpenCode (GLM-5.3).
   - Generated: Code, tests and this description.
   - Human review: the diff was reviewed by the author across multiple review 
passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to