release-21.1: colexec: make vectorized stats concurrency safe #62047
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.
Backport 2/2 commits from #61937.
/cc @cockroachdb/release
colflow: clean up vectorized stats for rowexec processors
Previously, the wrapped row-execution KV reading processors were
implementing
execinfra.KVReader
interface, but they were never used assuch, only the ColBatchScans would get used to retrieve the KV stats.
This is the case because the row-execution processors report their
execution stats themselves, and we don't want to duplicate that info.
This commit moves
KVReader
interface intocolexecop
package and nowonly the ColBatchScans implement it. This allowed for some cleanup
around the vectorized stats code, but the main reason for performing
this change is that the contract of the interface will be modified by
the follow-up commit to mention the safety under concurrent usage, and
I didn't want to change the row-execution processors for that since the
relevant methods never get called anyway.
Additionally, this commit begins emitting of rows-read and bytes-read by
the zigzagJoiners and invertedJoiners to complete the metrics picture.
Release note: None
colexec: make vectorized stats concurrency safe
Previously, the collection of vectorized stats was not synchronized with
the operators themselves. Namely, it was possible to call methods like
GetBytesRead
on the ColBatchScans and Inboxes from a differentgoroutine (the root materializer or the outbox) than from the main
goroutine of the operator. This is now fixed by putting mutexes in place
and updating
colexecop.KVReader
interface to require concurrency-safeimplementations.
Fixes: #61899.
Release note: None