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

session: switch to pessimistic txn mode for autocommit statement retry. #18952

Merged
merged 4 commits into from
Aug 4, 2020

Conversation

coocood
Copy link
Member

@coocood coocood commented Aug 3, 2020

What problem does this PR solve?

Optimize high conflicting autocommit DML.

What is changed and how it works?

Autocommit statements always use optimistic transaction mode, but when the conflict rate is high (zipfian distribution), it may retry too many times.

Switch to pessimistic transaction mode for retry can reduce retry cost.

Check List

Tests

  • Manual test (add detailed scripts or steps below)

benchmark ycsb zipfian workload and compare the result.
There is no error anymore and the performance increased more than 200%.

Release note

  • switch to pessimistic txn mode for autocommit statement retry

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

maybe we could force using pessimistic transaction for transaction retry

@coocood
Copy link
Member Author

coocood commented Aug 4, 2020

maybe we could force using pessimistic transaction for transaction retry

It's possible that the TiKV is configured to disable pessimistic transactions.

@coocood
Copy link
Member Author

coocood commented Aug 4, 2020

/run-all-tests

@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #18952 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #18952   +/-   ##
===========================================
  Coverage   79.5369%   79.5369%           
===========================================
  Files           548        548           
  Lines        149044     149044           
===========================================
  Hits         118545     118545           
  Misses        20995      20995           
  Partials       9504       9504           

@zhangjinpeng87
Copy link
Contributor

/release

Copy link
Member

@jackysp jackysp 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-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 4, 2020
@tiancaiamao
Copy link
Contributor

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Aug 4, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 4, 2020
@coocood
Copy link
Member Author

coocood commented Aug 4, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 4, 2020
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 18715

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 75d58d5 into pingcap:master Aug 4, 2020
@coocood coocood deleted the autocommit-retry-pessimistic branch August 4, 2020 08:51
@coocood
Copy link
Member Author

coocood commented Sep 4, 2020

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #19796

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Sep 4, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
ti-srebot added a commit that referenced this pull request Sep 4, 2020
…y. (#18952) (#19796)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/session sig/transaction SIG:Transaction status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants