sql: produce mock ContentionEvents and display contention time in EXPLAIN ANALYZE#56906
Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom Dec 1, 2020
asubiotto:cont
Merged
sql: produce mock ContentionEvents and display contention time in EXPLAIN ANALYZE#56906craig[bot] merged 2 commits intocockroachdb:masterfrom asubiotto:cont
craig[bot] merged 2 commits intocockroachdb:masterfrom
asubiotto:cont
Conversation
Member
RaduBerinde
approved these changes
Nov 19, 2020
Member
RaduBerinde
left a comment
There was a problem hiding this comment.
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
Contributor
Author
|
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)
Contributor
Author
|
TFTR bors r=RaduBerinde,tbg |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ContentionEventprotobuf? It's close to what's described in #55583 (minus some fields that can be added later).