Skip to content

feat: pass -Dtsfile.locale=zh to JVM under with-zh-locale build#17716

Open
JackieTien97 wants to merge 2 commits into
masterfrom
ty/adapt-tsfile-zh
Open

feat: pass -Dtsfile.locale=zh to JVM under with-zh-locale build#17716
JackieTien97 wants to merge 2 commits into
masterfrom
ty/adapt-tsfile-zh

Conversation

@JackieTien97
Copy link
Copy Markdown
Contributor

Summary

TsFile PR #820 adds runtime i18n for log/exception messages, selected at JVM startup via -Dtsfile.locale=zh (or Locale.getDefault()). The PR description explicitly asks IoTDB's Chinese build to pass that option from the startup scripts.

This change wires the with-zh-locale Maven profile to do exactly that — packaged Chinese builds now also get Chinese messages from tsfile, with no change required on the user's side.

Mechanism

A single small file conf/iotdb-locale.{sh,bat} holds the JVM option behind a Maven placeholder:

TSFILE_LOCALE_JVM_OPT=\"@tsfile.locale.opt@\"
  • Default build: filtered to \"\" → no JVM option appended.
  • with-zh-locale build: filtered to \"-Dtsfile.locale=zh\" → appended to IOTDB_JMX_OPTS / CONFIGNODE_JMX_OPTS.

The existing complex datanode-env.{sh,bat} and confignode-env.{sh,bat} are copied unchanged; they each source / CALL the locale file on startup and append \$TSFILE_LOCALE_JVM_OPT only when non-empty. Filtering is isolated to the tiny new file so the existing scripts' \${item_arr[@]} and @REM patterns can't be misinterpreted by the Maven filter.

Files changed

  • pom.xml — new property tsfile.locale.opt (empty by default; -Dtsfile.locale=zh under with-zh-locale)
  • scripts/conf/iotdb-locale.sh (new) + scripts/conf/windows/iotdb-locale.bat (new)
  • scripts/conf/datanode-env.sh, scripts/conf/confignode-env.sh, and the Windows .bat counterparts — source the locale file
  • 6 assembly XMLs add a filtered fileSet for iotdb-locale.*: iotdb-core/datanode/src/assembly/server.xml, iotdb-core/confignode/src/assembly/confignode.xml, distribution/src/assembly/{datanode,confignode,all}.xml, integration-test/src/assembly/mpp-test.xml

Test plan

  • Built iotdb-core/datanode with default profile — packaged conf/iotdb-locale.sh resolves to TSFILE_LOCALE_JVM_OPT=\"\"
  • Built iotdb-core/datanode with -P with-zh-locale — packaged conf/iotdb-locale.sh resolves to TSFILE_LOCALE_JVM_OPT=\"-Dtsfile.locale=zh\"; same result for the .bat
  • Repeated for iotdb-core/confignode — both .sh and .bat filter correctly
  • Verified datanode-env.sh is copied unchanged (filter is scoped to iotdb-locale.* only) and that the new "Apply tsfile locale" block appears in the packaged file

Scope note

Covers DataNode and ConfigNode, the heavy tsfile users called out in the tsfile PR. CLI (start-cli.sh) and scripts/tools/*.sh don't currently source these env files; can be extended separately if needed.

Pairs with apache/tsfile#820 — no coordinated release required, since the tsfile JAR ships a single artifact and tsfile falls back to English when the option is absent.

TsFile (apache/tsfile#820) selects its message locale at runtime via the
-Dtsfile.locale system property. Wire IoTDB's with-zh-locale build to
emit a filtered conf/iotdb-locale.{sh,bat} that the env scripts source
on startup, appending -Dtsfile.locale=zh to IOTDB_JMX_OPTS /
CONFIGNODE_JMX_OPTS so packaged Chinese builds also get Chinese
log/exception messages from tsfile.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.40%. Comparing base (a37621b) to head (d383aaa).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17716      +/-   ##
============================================
+ Coverage     40.38%   40.40%   +0.01%     
  Complexity     2574     2574              
============================================
  Files          5179     5179              
  Lines        349660   349660              
  Branches      44689    44689              
============================================
+ Hits         141217   141272      +55     
+ Misses       208443   208388      -55     

☔ View full report in Codecov by Sentry.
📢 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.

Drop the separate iotdb-locale.sh and put the filtered placeholder
directly in iotdb-common.sh, which is already sourced by start-*.sh
before the env scripts run. The env scripts now just append
$TSFILE_LOCALE_JVM_OPT when non-empty.

Windows still uses a small iotdb-locale.bat since there is no shared
common bat to filter.
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant