-
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
*: add a variable to control the back off time and disable txn auto retry by default #10266
Conversation
/run-all-tests |
/rebuild |
1 similar comment
/rebuild |
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #10266 +/- ##
================================================
- Coverage 77.8343% 77.8204% -0.0139%
================================================
Files 410 410
Lines 84306 84330 +24
================================================
+ Hits 65619 65626 +7
- Misses 13797 13807 +10
- Partials 4890 4897 +7 |
Codecov Report
@@ Coverage Diff @@
## master #10266 +/- ##
================================================
- Coverage 77.3234% 77.3131% -0.0103%
================================================
Files 412 412
Lines 85542 85543 +1
================================================
- Hits 66144 66136 -8
- Misses 14383 14387 +4
- Partials 5015 5020 +5 |
I think you can split it into 2 PRs. One for the weight variable, one for refactor write conflict error. |
It is not a big PR. I think it is not necessary. |
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.
Should we split this PR into two? It seems we both add tidb_back_off_weight
and fix the retryableMark
for network error?
@@ -241,6 +241,9 @@ func (b *Backoffer) WithVars(vars *kv.Variables) *Backoffer { | |||
if vars != nil { | |||
b.vars = vars | |||
} | |||
if math.MaxInt32/b.vars.BackOffWeight >= b.maxSleep { | |||
b.maxSleep *= b.vars.BackOffWeight |
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.
So all backoff will use this weight? How about specifying only prewrite
,commit
,get_tso
which will only be used in 2pc?
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.
What are the benefits of doing this?
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.
I mean, if there is a physical failure, the need to change the backoff should be similar. Still keeping other values fixed, which may make this parameter very useless.
Signed-off-by: Yu Shuaipeng <[email protected]>
Signed-off-by: Shuaipeng Yu <[email protected]>
Signed-off-by: Shuaipeng Yu <[email protected]>
/run-all-tests |
/run-common-test tidb-test=pr/800 |
1 similar comment
/run-common-test tidb-test=pr/800 |
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
@jackysp Please add more description or comment about background & how-to-use for
and how and when to choose right BackOffWeight value for new viewer like me :D |
Signed-off-by: Shuaipeng Yu <[email protected]>
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
LGTM |
/run-all-tests |
@@ -18,6 +18,9 @@ type Variables struct { | |||
// BackoffLockFast specifies the LockFast backoff base duration in milliseconds. | |||
BackoffLockFast int | |||
|
|||
// BackOffWeight specifies the weight of the max back off time duration. | |||
BackOffWeight int |
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.
backoff weight is a little confusion, how about directly set the max backoff time?
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.
There are many kinds of backoffs. Maybe set them separately in the future.
What problem does this PR solve?
If TiKV doesn't return a retryable error, TiDB should not retry the transaction. But we need a way to control the back off time to avoid the SQL failing when the PD/TiKV is not available.
What is changed and how it works?
Add a variable to control the back off time, and disable txn auto retry by default.
Check List
Tests
Code changes
Side effects