Skip to content

*: enable memory arbitrator by default#69638

Open
solotzg wants to merge 6 commits into
pingcap:masterfrom
solotzg:def-use-arbitrate
Open

*: enable memory arbitrator by default#69638
solotzg wants to merge 6 commits into
pingcap:masterfrom
solotzg:def-use-arbitrate

Conversation

@solotzg

@solotzg solotzg commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #58194

Problem Summary:

The global memory arbitrator is currently disabled by default. This PR enables it by default in priority mode.

What changed and how does it work?

Set the default value of tidb_mem_arbitrator_mode to priority.

Update memory arbitrator tests to expect the new default mode and keep memory package test helpers isolated by resetting the test arbitrator mode to disable before setup.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

TiDB now enables the global memory arbitrator in priority mode by default.

Summary by CodeRabbit

  • New Features
    • Updated the default memory management mode to use a higher-priority setting, changing the system’s out-of-the-box behavior.
    • Memory limits now reflect the configured global settings more consistently when the feature is enabled.

@ti-chi-bot ti-chi-bot Bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 3, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign terry1purcell for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1720b606-8b58-40fe-9d80-4e67d36010de

📥 Commits

Reviewing files that changed from the base of the PR and between 827f8f4 and 3c80a17.

📒 Files selected for processing (1)
  • pkg/sessionctx/vardef/tidb_vars.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/sessionctx/vardef/tidb_vars.go

📝 Walkthrough

Walkthrough

The default TiDB memory arbitrator mode is changed from disabled to priority via the DefTiDBMemArbitratorModeText constant. The associated test, TestGlobalMemArbitrator, is updated to assert active arbitrator behavior (priority mode, non-zero limits) instead of disabled/zero state.

Changes

Mem Arbitrator Default Mode

Layer / File(s) Summary
Default mode constant update
pkg/sessionctx/vardef/tidb_vars.go
DefTiDBMemArbitratorModeText default changed from ArbitratorModeDisableName to ArbitratorModePriorityName.
Test expectations for active arbitrator
pkg/executor/test/memtest/mem_test.go
TestGlobalMemArbitrator updated to assert priority mode via session variable and non-zero Limit()/SoftLimit() values instead of the previous disabled/zero-value assertions.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

A hop, a flip, the default's set,
No more disabled, no regret,
Priority mode now takes the lead,
Limits and soft-limits, just what we need,
This bunny thumps approval — tests agreed! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling the memory arbitrator by default.
Description check ✅ Passed The description covers the issue, problem summary, implementation, tests, side effects, documentation, and release note.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: context deadline exceeded"
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.1388%. Comparing base (8be4bd0) to head (3c80a17).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #69638        +/-   ##
================================================
- Coverage   76.3268%   74.1388%   -2.1881%     
================================================
  Files          2041       2050         +9     
  Lines        560589     576524     +15935     
================================================
- Hits         427880     427428       -452     
- Misses       131808     148887     +17079     
+ Partials        901        209       -692     
Flag Coverage Δ
integration 40.9419% <ø> (+1.2367%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 60.4471% <ø> (ø)
parser ∅ <ø> (∅)
br 47.4650% <ø> (-15.2563%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

@solotzg: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test-next-gen 3c80a17 link true /test pull-unit-test-next-gen
idc-jenkins-ci-tidb/unit-test 3c80a17 link true /test unit-test
idc-jenkins-ci-tidb/check_dev_2 3c80a17 link true /test check-dev2
pull-integration-realcluster-test-next-gen 3c80a17 link true /test pull-integration-realcluster-test-next-gen

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant