Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txn: skips resolving lock in auto commit optimistic statement #58676

Merged
merged 8 commits into from
Feb 7, 2025

Conversation

ekexium
Copy link
Member

@ekexium ekexium commented Jan 3, 2025

What problem does this PR solve?

Issue Number: close #58675

Problem Summary:

An autocommit optimistic statement can retry with pessimistic mode. Locks imply contention, which can be better handled in pessimistic mode.

What changed and how does it work?

Remove the attempt to resolve locks in its first optimistic execution.

A sysbench update_non_index with pareto distribution shows the difference:
Skip resolving locks:

Throughput:
    events/s (eps):                      1354.3807
    time elapsed:                        300.3328s
    total number of events:              406765

Latency (ms):
         min:                                    0.63
         avg:                                   73.79
         max:                                  582.63
         95th percentile:                      484.44
         sum:                             30015198.03

Master (try resolving locks)

Throughput:
    events/s (eps):                      1172.5760
    time elapsed:                        300.3959s
    total number of events:              352237

Latency (ms):
         min:                                    0.64
         avg:                                   85.23
         max:                                 1028.40
         95th percentile:                      590.56
         sum:                             30019655.50

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.

Skips resolving lock in auto commit optimistic statement

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 3, 2025
Copy link

tiprow bot commented Jan 3, 2025

Hi @ekexium. 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.

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.

@siddontang
Copy link
Member

how about the benchmark results?

@ekexium
Copy link
Member Author

ekexium commented Jan 3, 2025

how about the benchmark results?

Attached.

Signed-off-by: ekexium <[email protected]>
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.5957%. Comparing base (444c38f) to head (3432e0f).
Report is 4 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58676        +/-   ##
================================================
+ Coverage   73.0574%   73.5957%   +0.5382%     
================================================
  Files          1689       1689                
  Lines        466990     467345       +355     
================================================
+ Hits         341171     343946      +2775     
+ Misses       104844     102451      -2393     
+ Partials      20975      20948        -27     
Flag Coverage Δ
integration 42.8864% <68.0000%> (?)
unit 72.3789% <96.0000%> (+0.1208%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.4717% <ø> (+0.0630%) ⬆️

@ekexium ekexium requested review from cfzjywxk and you06 January 8, 2025 12:19
@ekexium ekexium force-pushed the prewrite-encounter-lock-policy branch from 560d8af to d40cba1 Compare January 8, 2025 12:24
@ekexium ekexium force-pushed the prewrite-encounter-lock-policy branch from c4cafff to 27ce608 Compare January 9, 2025 05:02
@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 Jan 9, 2025
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 13, 2025
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 15, 2025
@ekexium
Copy link
Member Author

ekexium commented Jan 15, 2025

/retest

@cfzjywxk cfzjywxk requested a review from MyonKeminta January 21, 2025 08:35
@cfzjywxk
Copy link
Contributor

@MyonKeminta @you06 PTAL

Copy link

ti-chi-bot bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, you06

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

The pull request process is described here

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 7, 2025
Copy link

ti-chi-bot bot commented Feb 7, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-13 02:24:27.983400922 +0000 UTC m=+752411.272232627: ☑️ agreed by cfzjywxk.
  • 2025-02-07 06:58:02.378094879 +0000 UTC m=+427753.910506877: ☑️ agreed by you06.

@ti-chi-bot ti-chi-bot bot merged commit 4734c9c into pingcap:master Feb 7, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Skips resolving lock in auto commit optimistic statement
4 participants