Skip to content

docs: add tidb_dml_max_execution_time system variable- #21929 - #23825

Open
gengliqi wants to merge 3 commits into
pingcap:masterfrom
gengliqi:add-dml-timeout
Open

gengliqi wants to merge 3 commits into
pingcap:masterfrom
gengliqi:add-dml-timeout

Conversation

@gengliqi

@gengliqi gengliqi commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

First-time contributors' checklist

What is changed, added, or deleted? (Required)

Add tidb_dml_max_execution_time system variable.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

  • Related code change PR links (if applicable):
  • This PR is translated from:
  • Other reference link(s):

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Documentation
    • Added documentation for the tidb_dml_max_execution_time system variable.
    • Documented its supported scopes, millisecond-based values, default unlimited setting, and SET_VAR support.
    • Clarified which transactional DML and commit operations are subject to the timeout, along with applicable exclusions and autocommit behavior.
    • Documented availability starting in TiDB v8.5.9 and v9.0.0, timeout precision, and post-interruption TiKV request behavior.
    • Added cross-references in the system-variable reference and SQL timeout guide.

u
Signed-off-by: gengliqi <gengliqiii@gmail.com>
Signed-off-by: gengliqi <gengliqiii@gmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Sep 10, 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 oreoxmt 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 missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/develop This PR relates to the area of TiDB App development. labels Sep 10, 2026
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

This change documents tidb_dml_max_execution_time, including its scope, default value, supported statements, exclusions, timeout behavior, and availability. It adds cross-references in the system-variable reference and TiDB timeout guide.

Changes

DML timeout documentation

Layer / File(s) Summary
Define and cross-reference DML timeout variable
system-variables.md, develop/dev-guide-timeouts-in-tidb.md, system-variable-reference.md
Documents tidb_dml_max_execution_time, including its scopes, range, default, supported statements, transaction behavior, exclusions, and timeout details. Adds links from the system-variable reference and timeout guide.

Priority: ⬇️ Low

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

Change: Other

Suggested reviewers: qiancai, lilin90, ti-chi-bot

Merge Risk: 🟡 Moderate · up to e0368

Readers could retry non-idempotent work after an ambiguous commit and apply it twice. Correct the retry guidance before merging.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the documentation change for the tidb_dml_max_execution_time system variable. The issue number is additional but does not obscure the main change.
Description check ✅ Passed The description uses the required template, identifies the change, selects the affected master, v9.0, and v8.5 branches, records AI involvement, and completes the checklist. Optional reference-link fi…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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

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.

Signed-off-by: gengliqi <gengliqiii@gmail.com>

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 502932fd-e248-4809-b823-3b1fad8ca0cd

📥 Commits

Reviewing files that changed from the base of the PR and between e9f3899 and e0368f3.

📒 Files selected for processing (1)
  • system-variables.md

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread system-variables.md
>
> - The statement might finish later than the configured timeout.
> - For `COMMIT` and autocommit DML statements, if the statement times out and TiDB cannot determine whether the transaction has committed, it closes the client connection. The client might receive a connection error instead of a statement timeout error. A connection loss does not mean that the transaction has been rolled back; the transaction might have committed.
> - When enabling this variable, it is recommended to set a relatively long timeout and allow sufficient headroom for normal DML execution and transaction commits. After TiDB interrupts a statement, requests already sent to TiKV might continue running or remain queued. An excessively short timeout combined with frequent application retries might cause retries to overlap with unfinished requests, increasing TiKV load and worsening request buildup during a failure. If your application retries an operation, use exponential backoff with jitter to reduce the additional load on TiKV.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Warn against blind retries after an ambiguous transaction outcome.

The preceding bullet states that a timed-out COMMIT or autocommit DML statement may have committed before the client connection closes. Retrying non-idempotent work can therefore apply its effects twice. Add outcome verification or an idempotency requirement while retaining exponential backoff for load control.

Suggested replacement
Suggested change
> - When enabling this variable, it is recommended to set a relatively long timeout and allow sufficient headroom for normal DML execution and transaction commits. After TiDB interrupts a statement, requests already sent to TiKV might continue running or remain queued. An excessively short timeout combined with frequent application retries might cause retries to overlap with unfinished requests, increasing TiKV load and worsening request buildup during a failure. If your application retries an operation, use exponential backoff with jitter to reduce the additional load on TiKV.
> - When enabling this variable, it is recommended to set a relatively long timeout and allow sufficient headroom for normal DML execution and transaction commits. After TiDB interrupts a statement, requests already sent to TiKV might continue running or remain queued. An excessively short timeout combined with frequent application retries might cause retries to overlap with unfinished requests, increasing TiKV load and worsening request buildup during a failure. If a timed-out `COMMIT` or autocommit DML statement causes TiDB to close the client connection before it confirms whether the transaction committed, do not blindly retry a non-idempotent operation. Verify the outcome or use an idempotency mechanism before retrying. If your application retries an operation, use exponential backoff with jitter to reduce the additional load on TiKV.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
> - When enabling this variable, it is recommended to set a relatively long timeout and allow sufficient headroom for normal DML execution and transaction commits. After TiDB interrupts a statement, requests already sent to TiKV might continue running or remain queued. An excessively short timeout combined with frequent application retries might cause retries to overlap with unfinished requests, increasing TiKV load and worsening request buildup during a failure. If your application retries an operation, use exponential backoff with jitter to reduce the additional load on TiKV.
> - When enabling this variable, it is recommended to set a relatively long timeout and allow sufficient headroom for normal DML execution and transaction commits. After TiDB interrupts a statement, requests already sent to TiKV might continue running or remain queued. An excessively short timeout combined with frequent application retries might cause retries to overlap with unfinished requests, increasing TiKV load and worsening request buildup during a failure. When a connection closes before TiDB confirms the transaction outcome, do not retry non-idempotent operations blindly. Verify the outcome or use an idempotency mechanism before retrying. If your application retries an operation, use exponential backoff with jitter to reduce the additional load on TiKV.

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

Labels

area/develop This PR relates to the area of TiDB App development. missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant