*: modify autoid allocator's Alloc() method, add context and tracing #21617
Conversation
LGTM |
LGTM |
/merge |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@tiancaiamao merge failed. |
/run-check_dev_2 |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
xuyifangreeneyes
added a commit
to xuyifangreeneyes/tidb
that referenced
this pull request
Dec 14, 2020
StoneDotYang
added a commit
to StoneDotYang/tidb
that referenced
this pull request
Dec 14, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
What problem does this PR solve?
Problem Summary:
We observed a puzzling phenomenon that running the
replace into ...
statement result in transaction conflict on the autoid meta key.I want to know why
replace into ...
triggers the auto-id allocation, but the trace result does not tell me why.After this change:
Get auto-id is bad for the performance of the replace statement:
replace
operation needs to get auto-id, and this takes 1ms+.replace
operation in different sessions, the autoid.Alloc() transaction would conflict and make the situation worse.We are not aware of it before.
B.T.W, the clustered index avoids this auto-id allocation, so the performance is much better.
What is changed and how it works?
Every operation involved with networking should be traced.
What's Changed:
Change the interface method, add the
ctx
parameter.How it Works:
Trace the auto-id allocation.
Release note