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

release-21.1: kvccl: re-order enterprise check in canSendToFollower #62606

Merged

Conversation

nvanbenschoten
Copy link
Member

Backport 1/1 commits from #62465.

/cc @cockroachdb/release


Fixes #62447.

In #62447, Erik found that #59571 had re-ordered the call to
utilccl.CheckEnterpriseEnabled to occur before checking the batch in
canSendToFollower, instead of after. This added an error allocation
into the hot path of all reads, which showed up in CPU profiles and
caused an 8% performance regression on kv95. This commit fixes this by
moving the enterprise check back out of the hot-path for all non-stale
read-only batches.

A follow up to this PR would be to make utilccl.CheckEnterpriseEnabled
cheaper by avoiding the error allocation for callers that don't need an
error. This work is not done in this commit.

Fixes cockroachdb#62447.

In cockroachdb#62447, Erik found that cockroachdb#59571 had re-ordered the call to
`utilccl.CheckEnterpriseEnabled` to occur before checking the batch in
`canSendToFollower`, instead of after. This added an error allocation
into the hot path of all reads, which showed up in CPU profiles and
caused an 8% performance regression on `kv95`. This commit fixes this by
moving the enterprise check back out of the hot-path for all non-stale
read-only batches.

A follow up to this PR would be to make `utilccl.CheckEnterpriseEnabled`
cheaper by avoiding the error allocation for callers that don't need an
error. This work is not done in this commit.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten merged commit 2b685a0 into cockroachdb:release-21.1 Mar 25, 2021
@nvanbenschoten nvanbenschoten deleted the backport21.1-62465 branch March 25, 2021 18:43
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