-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: make tidb_disable_txn_auto_retry disable retry for the explicit transactions #10339
Conversation
Signed-off-by: Shuaipeng Yu <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #10339 +/- ##
===============================================
- Coverage 77.6992% 77.6652% -0.034%
===============================================
Files 411 411
Lines 85441 85405 -36
===============================================
- Hits 66387 66330 -57
- Misses 14095 14111 +16
- Partials 4959 4964 +5 |
Codecov Report
@@ Coverage Diff @@
## master #10339 +/- ##
================================================
- Coverage 77.6767% 77.6652% -0.0115%
================================================
Files 411 411
Lines 85440 85405 -35
================================================
- Hits 66367 66330 -37
+ Misses 14112 14111 -1
- Partials 4961 4964 +3 |
/run-all-tests |
/run-unit-test |
do we need to set tidb_retry_limit to 0 by default later? |
Please test this in jepsen @overvenus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use failpoint to add some tests ?
@siddontang Yes, I think so. But for autocommit txn, we could do the retry. |
Should we merge this PR after #10266 ? I think this PR will make user's query easier to fail. |
Is this PR duplicated with https://github.com/pingcap/tidb/pull/10266/files#diff-928cb614ae092ed4c6f349f4c4c991e4R408? |
I think it is not necessary, this pr actually reverts something to it used to be.
It is part of #10266, I think it is better to split it out of that pr. |
I think we could set |
@jackysp so we still need to improve other retires like PD crashed later? |
We could improve the backoff in TiDB. |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I am a little confused, how can I solve the write conflict? Can I still do this on the official website? 9.1.1 Error 8005 (HY000): Write conflict, txnStartTS is outdated |
Yes, you could follow our documents on the official website. Or you could catch the error code and retry the transaction in the application logic. @liuhuanHappyStudy |
Thank you for your reply! |
I think the data consistency here refers to the problem that the isolation level is broken. Indeed, retrying brings this problem, the same as the Read Committed isolation level, it has the same problem as retrying. If the application is written using the Read Committed isolation level, there should be no problems. Because the application has handled this problem. I think many financial scenarios use the Read Committed isolation level because they like to use Oracle, the default level of Oracle is Read Committed. However, it is recommended to disable retry to capture the error code yourself to avoid this problem. @liuhuanHappyStudy |
Thank you very much for your advice! |
Signed-off-by: Shuaipeng Yu [email protected]
What problem does this PR solve?
It is not a good idea to make
tidb_disable_txn_auto_retry
deal with the write-conflict error only. Some rigorous tests e.g. jepsen will find that this will make the transaction behave abnormally. Although we can settidb_retry_limit = 0
to disable retry either.What is changed and how it works?
Make
tidb_disable_txn_auto_retry
work the same as before, it will disable retry for the explicit transactions, no matter what kind of error.Check List
Tests
Code changes