-
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
infoschema, executor, txn: implement DATA_LOCK_WAITS table #24750
Conversation
a1611e3
to
25706c7
Compare
5b75241
to
f80f6ee
Compare
f80f6ee
to
9e58797
Compare
0cb2fa3
to
2d156a3
Compare
store/driver/tikv_driver.go
Outdated
// GetLockWaits get return lock waits info | ||
func (s *tikvStore) GetLockWaits() ([]*deadlockPB.WaitForEntry, error) { | ||
stores := s.GetRegionCache().GetStoresByType(tikvrpc.TiKV) | ||
var resp *tikvrpc.Response | ||
var err error | ||
for _, store := range stores { | ||
resp, err = s.GetTiKVClient().SendRequest(context.TODO(), store.Addr, tikvrpc.NewRequest(tikvrpc.CmdLockWaitInfo, &kvrpcpb.GetLockWaitInfoRequest{}), time.Second*30) | ||
if err == nil { | ||
break | ||
} | ||
} | ||
if resp == nil { | ||
return nil, err | ||
} | ||
return resp.Resp.(*kvrpcpb.GetLockWaitInfoResponse).Entries, nil | ||
} |
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 just noticing that there are several problems:
- If the cluster is large and the transactions conflict very frequently, is it possible that the amount of lock waiting will be too large, and consumes too much memory in TiDB? Perhaps the problem is not that bad since the deadlock detector works well.
- We didn't set a limit of entries returned by the GetLockWaitInfo request. But is it possible that there are too many lock wait entries in a single TiKV node, and scanning so many entries occupies the lock manager's thread for too long and increases the node's latency?
PTAL @youjiali1995
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 think it's ok for now, but we should file issues for potential risks of the feature.
@youjiali1995: Thanks for your review. The bot only counts In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Please also fix the test caused by removing the HASH column. Rest LGTM. |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: ee154c1
|
/run-mybatis-test |
😕 I don't understand what's wrong with mybatis-test |
That's strange, it seems not related to this PR from the error messages .
|
/merge |
@longfangsong: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/run-all-tests This bot automatically retries jobs that failed on can merge PRs (send feedback to hi-rustin). Silence the bot with the |
What problem does this PR solve?
We are going to implement the feature Lock View.
A part of it is to support display information about current lock waiting.
What is changed and how it works?
What's Changed:
Just implement the
DATA_LOCK_WAITS
table.How it Works:
Add an API in
Storage
interface for querying lock waits info and do the query when requested.Related changes
(the following pr need to be merged first)
Check List
Tests
Side effects
Release note
DATA_LOCK_WAITS
table