zgdgod opened a new issue, #68994:
URL: https://github.com/apache/doris/issues/68994

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   Apache Doris 4.0.3. The same code path is also present on master and 
branch-4.0 at the time of reporting.
   
   ### What's Wrong?
   
   `SHOW BACKEND CONFIG` fails when a backend uses an IPv6 address.
   
   An anonymized example of the original error uses `2001:db8::/32`, the IPv6 
prefix reserved by RFC 3849 for documentation:
   
   ```text
   failed to submit sql, err: Error 1105 (HY000): errCode = 2,
   detailMessage = Can't get backend config,
   backendId: <redacted>,
   host: 2001:db8::1234.
   error: Error at index 3 in:
   "db8::1234:8040"
   ```
   
   `ShowConfigCommand` currently constructs the backend HTTP endpoint using:
   
   ```java
   String.format("http://%s:%d/api/show_config";, host, httpPort);
   ```
   
   For an IPv6 backend this produces an invalid URL because the address is not 
enclosed in brackets:
   
   ```text
   http://2001:db8::1234:8040/api/show_config
   ```
   
   ### What You Expected?
   
   `SHOW BACKEND CONFIG` should access the backend using a valid bracketed IPv6 
authority:
   
   ```text
   http://[2001:db8::1234]:8040/api/show_config
   ```
   
   IPv4 addresses and hostnames should keep their existing behavior.
   
   ### How to Reproduce?
   
   1. Deploy or register a backend using an IPv6 address.
   2. Execute:
   
   ```sql
   SHOW BACKEND CONFIG;
   ```
   
   3. The FE fails while parsing the backend HTTP URL.
   
   ### Anything Else?
   
   A proposed fix is to use `NetUtils.getHostPortInAccessibleFormat(host, 
httpPort)` when constructing the backend config URL. This utility already 
formats IPv4 addresses, hostnames, and IPv6 addresses correctly.
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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