-
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
*: refine commit txn slow log #8731
Conversation
/run-all-tests |
/run-all-tests |
@tiancaiamao PTAL |
/run-all-tests |
The metrics is not mentioned in "What is changed and how it works?" section. Please refine the description. |
/rebuild |
/run-all-tests |
@tiancaiamao @jackysp @winkyao 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
Ctx: s, | ||
StartTime: time.Now(), | ||
} | ||
var commitDetail *execdetails.CommitDetails | ||
ctx = context.WithValue(ctx, execdetails.CommitDetailCtxKey, &commitDetail) |
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.
Why pointer of pointer? is it better to use commitDetail
?
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.
direct use commitDetail
will copy on withValue
call and couldn't get modification by callled method,
use pointer of commitDetail
can get change result, but hard to distinguish "has commitDetail" and "no commitDetail"
Signed-off-by: lysu <sulifx@gmail.com>
LGTM |
What problem does this PR solve?
1) commit slow log info is hard to find question:
run this script:
will got commit log like this:
we are hard to know the real reason make this slow.
2) no latch wait metric
From metric, we can't known how long time used in wait local latch, and we need add it to metrics
What is changed and how it works?
1) refine commit txn slow log
add more detail info in commit slow log, just like this:
we can got detail info:
so we can see
TxnRetry
to known whether slow by txn-retry, or no retry just slow in caused by latch, prewrite, getTs, commit or resolve; and we also can get write key count, data size and requested region count info which are missed in previous log.2) add latch wait to metric
Add a prometheus metric item,
local_latch_wait_seconds
:to record the time that wait latch when txn could not acquire lock success.
Check List
Tests
Code changes
Side effects
Related changes
This change is
@tiancaiamao @jackysp PTAL thx~