Skip to content

[Enhancement] Expose jemalloc runtime options as be config#75344

Merged
dirtysalt merged 2 commits into
StarRocks:mainfrom
trueeyu:jemalloc_config
Jun 25, 2026
Merged

[Enhancement] Expose jemalloc runtime options as be config#75344
dirtysalt merged 2 commits into
StarRocks:mainfrom
trueeyu:jemalloc_config

Conversation

@trueeyu

@trueeyu trueeyu commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Why I'm doing this:

The jemalloc runtime options used by BE/CN are currently set only as the JEMALLOC_CONF environment variable inside bin/start_backend.sh. Because information_schema.be_configs is populated purely from config::list_configs() (i.e. items declared in be/src/common/config.h), this value is invisible there — there is no way to confirm via SQL which jemalloc options a running BE/CN was started with.

What I'm doing:

  • Add a new BE config jemalloc_conf (CONF_String, immutable) in be/src/common/config.h, defaulting to the normal-mode jemalloc option string. This makes the value queryable through information_schema.be_configs.
  • In bin/start_backend.sh, the normal startup path (neither --jemalloc_debug nor --check_mem_leak) now reads jemalloc_conf from be.conf/cn.conf and exports it as JEMALLOC_CONF, falling back to the built-in default when unset. The --jemalloc_debug and --check_mem_leak modes keep forcing their own JEMALLOC_CONF values and ignore the config, as before.

Note: jemalloc reads JEMALLOC_CONF during process init, before BE config parsing, so this config does not reconfigure jemalloc at runtime — it serves as the single source of truth for the startup script and for observability. The script default and the config.h default are kept in sync (commented in both places).

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

Signed-off-by: trueeyu <lxhhust350@qq.com>
@github-actions

Copy link
Copy Markdown
Contributor

No new undocumented parameters detected by the param-drift check.

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 makes the BE/CN jemalloc startup configuration observable via information_schema.be_configs by introducing a new immutable BE config (jemalloc_conf) and wiring normal-mode startup to export JEMALLOC_CONF from be.conf/cn.conf (with a default matching the existing behavior).

Changes:

  • Added immutable BE config jemalloc_conf (string) to surface the normal-mode jemalloc option string via config::list_configs().
  • Updated bin/start_backend.sh normal-mode startup to read jemalloc_conf from be.conf/cn.conf and export it as JEMALLOC_CONF, falling back to the built-in default.

Reviewed changes

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

File Description
bin/start_backend.sh Reads jemalloc_conf from be/cn conf in normal mode and exports it as JEMALLOC_CONF for process startup.
be/src/common/config.h Declares new immutable jemalloc_conf config (defaulted to current normal-mode jemalloc string) for SQL observability.

Comment thread be/src/common/config.h
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: trueeyu <lxhhust350@qq.com>
@github-actions

Copy link
Copy Markdown
Contributor

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions

Copy link
Copy Markdown
Contributor

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@trueeyu trueeyu marked this pull request as ready for review June 25, 2026 09:36
@CelerData-Reviewer

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e0ee38a82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread be/src/common/config.h

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e0ee38a82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/start_backend.sh
Comment thread be/src/common/config.h

@dirtysalt dirtysalt 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.

LGTM! 🚀

@dirtysalt dirtysalt enabled auto-merge (squash) June 25, 2026 10:42
@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@dirtysalt dirtysalt merged commit b87328d into StarRocks:main Jun 25, 2026
111 of 112 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport branch-4.1

@github-actions github-actions Bot removed the 4.1 label Jun 25, 2026
@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.1

✅ Backports have been created

Details

wanpengfei-git pushed a commit that referenced this pull request Jun 25, 2026
…75344) (#75354)

Signed-off-by: trueeyu <lxhhust350@qq.com>
Co-authored-by: trueeyu <lxhhust350@qq.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants