-
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
store: when commit get a CommitTsExpired
error, retry with a new commitTS
#12980
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12980 +/- ##
===========================================
Coverage 80.1441% 80.1441%
===========================================
Files 468 468
Lines 109857 109857
===========================================
Hits 88044 88044
Misses 15106 15106
Partials 6707 6707 |
LGTM |
c.mu.Lock() | ||
c.commitTS = commitTS | ||
c.mu.Unlock() | ||
return c.commitKeys(bo, batch.keys) |
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'm kinda afraid that recursion may cause troubles...
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.
Retry two many times and stack overflow?
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.
- The old code also take this pattern
- If it's really a problem, we can refactor the code with another PR
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'm not sure to do we need a backoff here before recursion retry - -? @tiancaiamao if so I will add it at #16061 later
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
@youjiali1995 PTAL |
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
/run-all-tests |
1 similar comment
/run-all-tests |
/run-all-tests |
Your auto merge job has been accepted, waiting for 13021 |
/run-all-tests |
What problem does this PR solve?
Before we can use non-block read for large transaction, we have to handle the
commitTS
problem:We must guarantee the invariance that
commitTS > minCommitTS
There is an easiest way to handle that:
TiKV return a retryable error and TiDB retrying with a newer
commitTS
.What is changed and how it works?
In 2PC commit phase, if TiKV return a
CommitTsExpired
error,TiDB
get a new commitTS and retry.Check List
Tests
Side effects