Skip to content
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

colfetcher: track KV CPU time in the direct columnar scan #98264

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Mar 9, 2023

This commit addresses a minor TODO to track the KV CPU time when direct
columnar scans are used. In the regular columnar scan this time is
tracked by the cFetcher, but with the KV projection pushdown the
cFetcher is used on the KV server side, so we need to augment the
ColBatchDirectScan to track it. Notably, this means that the decoding
done on the KV server side is included. Additionally, this commit
clarifies how the KV CPU time is obtained from the cFetcher (we don't
need to use a helper (unlike in the case of bytesRead and
batchRequestsIssued fields which are written to on cFetcher.Close),
and we don't need the mutex protection there either).

Epic: CRDB-14837

Release note: None

@yuzefovich yuzefovich requested review from DrewKimball and a team March 9, 2023 00:04
@blathers-crl
Copy link

blathers-crl bot commented Mar 9, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Sorry, just realized I forgot to submit the review.

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)


pkg/sql/colfetcher/colbatch_direct_scan.go line 156 at r1 (raw file):

func (s *ColBatchDirectScan) GetKVCPUTime() time.Duration {
	s.mu.Lock()
	defer s.mu.Unlock()

[nit] timeutil.CPUStopWatch is already mutex-protected.

This commit addresses a minor TODO to track the KV CPU time when direct
columnar scans are used. In the regular columnar scan this time is
tracked by the cFetcher, but with the KV projection pushdown the
cFetcher is used on the KV server side, so we need to augment the
ColBatchDirectScan to track it. Notably, this means that the decoding
done on the KV server side is included. Additionally, this commit
clarifies how the KV CPU time is obtained from the cFetcher (we don't
need to use a helper (unlike in the case of `bytesRead` and
`batchRequestsIssued` fields which are written to on `cFetcher.Close`),
and we don't need the mutex protection there either).

Release note: None
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)


pkg/sql/colfetcher/colbatch_direct_scan.go line 156 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

[nit] timeutil.CPUStopWatch is already mutex-protected.

Done. I applied the same change to ColBatchScan and ColIndexJoin too.

@craig
Copy link
Contributor

craig bot commented Mar 15, 2023

Build succeeded:

@craig craig bot merged commit 1bb2934 into cockroachdb:master Mar 15, 2023
@yuzefovich yuzefovich deleted the kv-pushdown-cpu branch March 15, 2023 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants