-
Notifications
You must be signed in to change notification settings - Fork 3.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
sql: produce mock ContentionEvents and display contention time in EXPLAIN ANALYZE #56906
Conversation
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.
First commit looks good!
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto and @RaduBerinde)
pkg/sql/colexec/op_creation.go, line 81 at r2 (raw file):
type NewColOperatorResult struct { Op colexecbase.Operator KVReader execinfra.KVReader
Nice change :)
pkg/sql/colfetcher/colbatch_scan.go, line 135 at r2 (raw file):
// GetCumulativeContentionTime is part of the execinfra.KVReader interface. func (s *ColBatchScan) GetCumulativeContentionTime() time.Duration { var totalContentionTime time.Duration
I found that sometimes (maybe in error cases, or other early termination situation), s.rf.fetcher might be nil
here. I'm adding a check in GetBytesRead
in 56929, we should check here too.
pkg/sql/execinfrapb/component_stats.proto, line 92 at r2 (raw file):
// ContentionTime is the cumulative time a KV request spent contending with // other transactions. This time is a subset of KVTime above.
[nit] s/is a subset/accounts for a portion of
TFTRs! The CI failure should be fixed by #56951. Will wait for that to rebase, address comments, and update this PR. |
This commit adds a simple ContentionEvent protobuf. This protobuf is not yet emitted by KV although the idea is that it will be. In the meantime, the SQL Execution engine can use this message to generate mock contention events in order to build higher-level observability infrastructure around contention. Release note: None
This commit also implements mock contention event generation when either a testing knob or cluster setting is set. The former is useful for programmable tests, while the latter will be useful for observing changes to the DB console (e.g. global contention view). Release note: None (new behavior is only enabled in tests)
TFTR bors r=RaduBerinde,tbg |
Build succeeded: |
Please take a look at individual commits for details
Release note: None
Closes #56612
@tbg could you take a look at the first commit which defines a
ContentionEvent
protobuf? It's close to what's described in #55583 (minus some fields that can be added later).