Skip to content

statistics, config: rightly deal with innodb_lock_wait_timeout when to load stats (#65632)#65759

Merged
ti-chi-bot[bot] merged 8 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-65632-to-release-8.5
Feb 13, 2026
Merged

statistics, config: rightly deal with innodb_lock_wait_timeout when to load stats (#65632)#65759
ti-chi-bot[bot] merged 8 commits intopingcap:release-8.5from
ti-chi-bot:cherry-pick-65632-to-release-8.5

Conversation

@ti-chi-bot
Copy link
Copy Markdown
Member

@ti-chi-bot ti-chi-bot commented Jan 23, 2026

This is an automated cherry-pick of #65632

What problem does this PR solve?

Issue Number: close #65634

Problem Summary:

load large plan replayer (for example, plan replayer testing). You will see this error log.

[2026/01/19 15:34:53.818 +08:00] [WARN] [conn.go:1215] ["command dispatched failed"] [conn=2650800358] [session_alias=] [connInfo="id:2650800358, addr:127.0.0.1:37854 status:10, collation:utf8mb4_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="plan replayer load './replayer/partition/xxxx/plan_replayer1121.zip'"] [txn_mode=PESSIMISTIC] [timestamp=463682415160721420] [err="[tikv:1205]Lock wait timeout exceeded; try restarting transaction\ngithub.com/pingcap/errors.Trace\n\t/root/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20250523034308-74f78ae071ee/juju_adaptor.go:15\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.finishTransaction\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:71\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.WrapTxn.func1\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:195\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.WrapTxn\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:198\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.CallWithSCtx.func1.1\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:95\ngithub.com/pingcap/tidb/pkg/session/syssession.(*Session).WithSessionContext.func1\n\t/workspace/source/tidb/pkg/session/syssession/session.go:519\ngithub.com/pingcap/tidb/pkg/session/syssession.(*session).OwnerWithSctx\n\t/workspace/source/tidb/pkg/session/syssession/session.go:278\ngithub.com/pingcap/tidb/pkg/session/syssession.(*Session).WithSessionContext\n\t/workspace/source/tidb/pkg/session/syssession/session.go:518\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.CallWithSCtx.func1\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:83\ngithub.com/pingcap/tidb/pkg/session/syssession.(*AdvancedSessionPool).WithSession\n\t/workspace/source/tidb/pkg/session/syssession/pool.go:274\ngithub.com/pingcap/tidb/pkg/statistics/handle/util.CallWithSCtx\n\t/workspace/source/tidb/pkg/statistics/handle/util/util.go:82\ngithub.com/pingcap/tidb/pkg/statistics/handle/storage.(*statsReadWriter).SaveColOrIdxStatsToStorage\n\t/workspace/source/tidb/pkg/statistics/handle/storage/stats_read_writer.go:213\ngithub.com/pingcap/tidb/pkg/statistics/handle/storage.(*statsReadWriter).loadStatsFromJSON.func1\n\t/workspace/source/tidb/pkg/statistics/handle/storage/stats_read_writer.go:677\ngithub.com/pingcap/tidb/pkg/statistics.(*HistColl).ForEachColumnImmutable\n\t/workspace/source/tidb/pkg/statistics/table.go:333\ngithub.com/pingcap/tidb/pkg/statistics/handle/storage.(*statsReadWriter).loadStatsFromJSON\n\t/workspace/source/tidb/pkg/statistics/handle/storage/stats_read_writer.go:673\ngithub.com/pingcap/tidb/pkg/statistics/handle/storage.(*statsReadWriter).LoadStatsFromJSONConcurrently.func1\n\t/workspace/source/tidb/pkg/statistics/handle/storage/stats_read_writer.go:595\ngithub.com/tiancaiamao/gp.workerLoop\n\t/root/go/pkg/mod/github.com/tiancaiamao/gp@v0.0.0-20221230034425-4025bc8a4d4a/gp.go:72\ngithub.com/tiancaiamao/gp.worker\n\t/root/go/pkg/mod/github.com/tiancaiamao/gp@v0.0.0-20221230034425-4025bc8a4d4a/gp.go:51\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1693"]

What changed and how does it work?

  1. plan replayer cannot load innodb_lock_wait_timeout
  2. when loading stats, we use global innodb_lock_wait_timeout into internal sql.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

test it with plan replayer testing for release-8.5 .

  • 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 added component/statistics do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jan 23, 2026
@ti-chi-bot
Copy link
Copy Markdown
Member Author

@hawkingrei This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Jan 23, 2026

@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 23, 2026
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Feb 11, 2026
@hawkingrei hawkingrei force-pushed the cherry-pick-65632-to-release-8.5 branch from 5df0f3d to f900c2f Compare February 13, 2026 07:54
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 13, 2026
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei
Copy link
Copy Markdown
Member

/retest

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 58.13953% with 18 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-8.5@0c2a357). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-8.5     #65759   +/-   ##
================================================
  Coverage               ?   54.9051%           
================================================
  Files                  ?       1816           
  Lines                  ?     650990           
  Branches               ?          0           
================================================
  Hits                   ?     357427           
  Misses                 ?     267014           
  Partials               ?      26549           
Flag Coverage Δ
integration 38.1451% <11.6279%> (?)
unit 64.9013% <58.1395%> (?)

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

Components Coverage Δ
dumpling 52.9278% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 55.4697% <0.0000%> (?)
🚀 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.

@hawkingrei
Copy link
Copy Markdown
Member

/retest

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 13, 2026
@hawkingrei
Copy link
Copy Markdown
Member

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 13, 2026
Signed-off-by: Weizhen Wang <hawking.rei@gmail.com>
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 13, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Feb 13, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-13 08:52:24.100088782 +0000 UTC m=+181297.180079477: ☑️ agreed by hawkingrei.
  • 2026-02-13 09:15:22.791873413 +0000 UTC m=+690.538267446: ☑️ agreed by qw4990.

Copy link
Copy Markdown
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Feb 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, mjonss, qw4990

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:

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 merged commit 8b72a47 into pingcap:release-8.5 Feb 13, 2026
18 of 19 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-65632-to-release-8.5 branch February 13, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. component/statistics lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants