Skip to content

Fix IPv6 endpoint handling in client and ops tools#18291

Merged
HTHou merged 5 commits into
masterfrom
codex/fix-cli-ipv6-endpoint-format
Jul 23, 2026
Merged

Fix IPv6 endpoint handling in client and ops tools#18291
HTHou merged 5 commits into
masterfrom
codex/fix-cli-ipv6-endpoint-format

Conversation

@HTHou

@HTHou HTHou commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Format endpoints consistently for IPv4, hostnames, and IPv6 addresses across the CLI, table-model import/export tools, and operational scripts.

The CLI and Java tools now use UrlUtils.formatTEndPointIpv4AndIpv6Url instead of concatenating the host and port directly. Operational scripts preserve IPv6 hosts while checking ports, and display IPv6 endpoints with brackets. Windows port detection now reads the complete local endpoint from netstat before extracting its port, so IPv6 listeners are no longer missed.

Area Before After
CLI IPv6 JDBC URL jdbc:iotdb://::1:6667/ jdbc:iotdb://[::1]:6667/
CLI IPv6 login output Successfully login at ::1:6667 Successfully login at [::1]:6667
Table data import/export Built seed URLs with direct host:port concatenation Uses the shared IPv4/IPv6 endpoint formatter
Table schema import/export Built seed URLs with direct host:port concatenation Uses the shared IPv4/IPv6 endpoint formatter
Unix health check output Displayed :::6667 Displays [::]:6667
Windows remote health check Joined and split endpoints using :, which breaks IPv6 literals Keeps host and port fields separated with an IPv6-safe delimiter
Windows local port detection Split netstat output on :, missing IPv6 listeners such as [::]:6667 Reads the complete endpoint and extracts the trailing port
Windows backup guard Could miss a running IoTDB process bound to IPv6 Detects both IPv4 and IPv6 listening endpoints
IPv4 and hostname endpoints Direct host:port output Output remains unchanged through the shared formatter
Login message localization Inline English text English and Chinese i18n messages

Validation

  • mvn spotless:apply -pl iotdb-client/cli -am
  • mvn test-compile -pl iotdb-client/cli -am -DskipTests
  • mvn test-compile -pl iotdb-client/cli -am -P with-zh-locale -DskipTests
  • mvn package -pl distribution -am -DskipTests
  • bash -n scripts/tools/ops/health_check.sh
  • Started a DataNode with dn_rpc_address=:: and verified CLI access through -h :: -p 16667.
  • Verified table data export/import and schema export/import through ::; the imported row was queried successfully.
  • Verified the Unix health check connects through :: and displays [::]:16667.
  • Verified table data export through both localhost and 127.0.0.1.

Windows batch changes were reviewed against IPv4 and IPv6 netstat /ano endpoint formats; runtime validation requires a Windows environment.

@HTHou
HTHou marked this pull request as ready for review July 23, 2026 09:07
@HTHou HTHou changed the title Fix CLI IPv6 endpoint formatting Fix IPv6 endpoint handling in client and ops tools Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes endpoint formatting across the CLI, table-model import/export tools, and ops scripts so IPv6 literals are handled safely (bracketed for display/URLs, and not split incorrectly when extracting ports).

Changes:

  • Updated Java CLI and table import/export tools to build node URLs / JDBC URLs via UrlUtils.formatTEndPointIpv4AndIpv6Url(...) for consistent IPv4/hostname/IPv6 formatting.
  • Improved Windows batch scripts to avoid :-splitting issues with IPv6, and to correctly extract the listening port from netstat output.
  • Updated ops health-check output formatting (Unix + Windows) to display IPv6 endpoints with brackets.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/tools/windows/ops/health_check.bat Uses an IPv6-safe endpoint delimiter and extracts ports from full netstat local endpoints to avoid missing IPv6 listeners.
scripts/tools/windows/ops/backup.bat Updates netstat parsing to correctly detect IPv6 listeners when deciding whether IoTDB is running.
scripts/tools/ops/health_check.sh Brackets IPv6 hosts in displayed host:ports output without affecting connectivity checks.
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/schema/ImportSchemaTable.java Builds table session pool node URLs using the shared IPv4/IPv6 endpoint formatter.
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/schema/ExportSchemaTable.java Builds table session pool node URLs using the shared IPv4/IPv6 endpoint formatter.
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportDataTable.java Builds table session pool node URLs using the shared IPv4/IPv6 endpoint formatter.
iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportDataTable.java Builds table session builder node URLs using the shared IPv4/IPv6 endpoint formatter.
iotdb-client/cli/src/main/java/org/apache/iotdb/cli/Cli.java Centralizes JDBC URL and login endpoint formatting via UrlUtils and localizes the login message.
iotdb-client/cli/src/main/i18n/zh/org/apache/iotdb/cli/i18n/CliMessages.java Adds i18n template for the successful login message.
iotdb-client/cli/src/main/i18n/en/org/apache/iotdb/cli/i18n/CliMessages.java Adds i18n template for the successful login message.
Comments suppressed due to low confidence (1)

scripts/tools/windows/ops/backup.bat:98

  • cn_internal_port_occupied is never set to 1 after detecting the ConfigNode internal port, so the guard if !cn_internal_port_occupied!==0 never flips and the script may repeatedly run :checkIfIOTDBProcess for every matching netstat row. Set the flag after the first match to make the guard effective.
       ) else if !local_port!==%cn_internal_port% (
         if !cn_internal_port_occupied!==0 (
             set spid=%%k
             call :checkIfIOTDBProcess !spid! is_iotdb
             if !is_iotdb!==1 (
              set local_iotdb_occupied_ports=%cn_internal_port% !local_iotdb_occupied_ports!
             )
         )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/tools/windows/ops/backup.bat

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Comment thread iotdb-client/cli/src/main/java/org/apache/iotdb/cli/Cli.java
Comment thread iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportDataTable.java Outdated
Comment thread iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportDataTable.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 9.09091% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.99%. Comparing base (f7be88e) to head (b0ab4ab).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...nt/cli/src/main/java/org/apache/iotdb/cli/Cli.java 0.00% 6 Missing ⚠️
...va/org/apache/iotdb/tool/data/ExportDataTable.java 0.00% 1 Missing ⚠️
...va/org/apache/iotdb/tool/data/ImportDataTable.java 0.00% 1 Missing ⚠️
...rg/apache/iotdb/tool/schema/ExportSchemaTable.java 0.00% 1 Missing ⚠️
...rg/apache/iotdb/tool/schema/ImportSchemaTable.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18291      +/-   ##
============================================
+ Coverage     42.83%   42.99%   +0.16%     
  Complexity      374      374              
============================================
  Files          5362     5362              
  Lines        381409   381409              
  Branches      49509    49511       +2     
============================================
+ Hits         163368   163989     +621     
+ Misses       218041   217420     -621     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HTHou
HTHou merged commit ed8cb43 into master Jul 23, 2026
43 of 45 checks passed
@HTHou
HTHou deleted the codex/fix-cli-ipv6-endpoint-format branch July 23, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants