Skip to content

privileges: fix TiDB panic when security.skip-grant-table is true#61791

Merged
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
djshow832:fix_skip
Jun 18, 2025
Merged

privileges: fix TiDB panic when security.skip-grant-table is true#61791
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
djshow832:fix_skip

Conversation

@djshow832
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #61790

Problem Summary:
When max_user_connections was introduced in #59197, the privilege system didn't consider skip-grant-table, which skips loading the privilege system.

What changed and how does it work?

If skip-grant-table is true, do not query max_user_connections and directly return.

I've checked other functions in UserPrivileges, no other similar problems.
It's introduced in v9.0.0-beta.1 so it doesn't need a release note.

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.

Steps:

  1. Start a TiDB instance with configuration security.skip-grant-table and OS root privilege.
  2. Connect to TiDB with mysql -h127.1 -uroot -P4000

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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 18, 2025
@tiprow
Copy link

tiprow bot commented Jun 18, 2025

Hi @djshow832. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@codecov
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.4728%. Comparing base (f350b69) to head (f05f733).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #61791        +/-   ##
================================================
+ Coverage   73.0339%   73.4728%   +0.4388%     
================================================
  Files          1730       1730                
  Lines        481684     481703        +19     
================================================
+ Hits         351793     353921      +2128     
+ Misses       108329     106208      -2121     
- Partials      21562      21574        +12     
Flag Coverage Δ
integration 42.2963% <0.0000%> (?)
unit 72.3207% <100.0000%> (+0.0254%) ⬆️

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

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 46.5910% <ø> (+0.0208%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 18, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CbcWestwolf, Defined2014

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [CbcWestwolf,Defined2014]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 18, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 18, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-06-18 04:18:43.130959952 +0000 UTC m=+245375.854138919: ☑️ agreed by CbcWestwolf.
  • 2025-06-18 04:23:57.010216259 +0000 UTC m=+245689.733395238: ☑️ agreed by Defined2014.

@ti-chi-bot ti-chi-bot bot merged commit a9cef85 into pingcap:master Jun 18, 2025
23 of 24 checks passed
@djshow832 djshow832 deleted the fix_skip branch June 18, 2025 06:01
crazycs520 pushed a commit that referenced this pull request Oct 30, 2025
…61791) (#195)

Reviewed-on: https://git.pingcap.net/pingkai/tidb/pulls/195
Reviewed-by: tianyuan <tianyuan@pingcap.cn>
Co-authored-by: yuchen.ding <yuchen.ding@pingcap.cn>
Co-committed-by: yuchen.ding <yuchen.ding@pingcap.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. 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.

TiDB panic when start with security.skip-grant-table

3 participants