Skip to content

Conversation

@fzzf678
Copy link
Contributor

@fzzf678 fzzf678 commented Feb 2, 2026

What problem does this PR solve?

Issue Number: close #65969

Problem Summary:

adminCheckTableBeforeDrop may call ExecRestrictedSQL multiple times. Each call can fetch a different internal session from the system session pool, so the sequence SET tidb_enable_fast_table_check=ON / ADMIN CHECK TABLE / restore may land on different sessions. This can break ADMIN CHECK TABLE on features that require fast check (e.g. partial indexes) and may leave the session pool in a polluted state.

The previous code also restored tidb_enable_fast_table_check using the user session's value, which can unintentionally propagate a user setting into the internal session pool.

What changed and how does it work?

  • Run the whole SET ON -> ADMIN CHECK TABLE -> restore sequence on a single internal session acquired once from DDL's session pool.
  • Restore tidb_enable_fast_table_check to the original value from the same internal session (instead of reading it from the user session).
  • Add (*session.Pool).Destroy() to discard internal sessions that should not be reused (e.g. sysvar change fails), while keeping the pool slot consistent for both DestroyableSessionPool and *pools.ResourcePool.
  • Add regression test that sets up mixed tidb_enable_fast_table_check values in the sys session pool and verifies DROP TABLE succeeds with partial indexes when check-table-before-drop is enabled.
  • Add unit tests covering Destroy() semantics for both pool types.

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.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 2, 2026
@tiprow
Copy link

tiprow bot commented Feb 2, 2026

Hi @fzzf678. 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 Feb 2, 2026

Codecov Report

❌ Patch coverage is 77.35849% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.8924%. Comparing base (1e2cdaa) to head (a6a4430).
⚠️ Report is 145 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65972        +/-   ##
================================================
+ Coverage   77.8543%   78.8924%   +1.0380%     
================================================
  Files          1961       1954         -7     
  Lines        539718     554664     +14946     
================================================
+ Hits         420194     437588     +17394     
+ Misses       117868     115588      -2280     
+ Partials       1656       1488       -168     
Flag Coverage Δ
integration 47.4199% <33.9622%> (-0.7818%) ⬇️
unit 76.7045% <77.3584%> (+0.2303%) ⬆️

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

Components Coverage Δ
dumpling 56.7974% <ø> (+0.1783%) ⬆️
parser ∅ <ø> (∅)
br 61.8904% <ø> (+0.7730%) ⬆️
🚀 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.

@fzzf678 fzzf678 force-pushed the ddl-fast-table-check branch from 05fbc26 to 0bba5cd Compare February 2, 2026 14:28
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 2, 2026

[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 benjamin2037 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
Copy link

ti-chi-bot bot commented Feb 3, 2026

@fzzf678: The following test 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-ddlv1 a6a4430 link true /test pull-unit-test-ddlv1

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-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inappropriate set/restore of system variable in adminCheckTableBeforeDrop

1 participant