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

roachpb: clarify ownership of BatchRequests #75452

Open
yuzefovich opened this issue Jan 24, 2022 · 1 comment
Open

roachpb: clarify ownership of BatchRequests #75452

yuzefovich opened this issue Jan 24, 2022 · 1 comment
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-kv KV Team

Comments

@yuzefovich
Copy link
Member

yuzefovich commented Jan 24, 2022

While working on the Streamer library, I assumed that it was ok to reuse the same RequestUnion, GetRequest, and ScanRequest objects to issue a follow-up request with the ResumeSpans. However, gRPC race transport began complaining about data races. As it turns out at the moment neither the server nor the client is allowed to modify BatchRequests. The comment suggests that it should be ok for the client to reuse the requests, so we should get there.

Some commentary from Andrei:

  • it's very likely that kv holds on to roachpb.Keys from requests, so they can't be mutated. It's kind of a mess.
  • we've never had a clear policy on who owns the batches and who needs to Clone them. There's probably cloning that's both insufficient and unnecessary.

Jira issue: CRDB-12678

@yuzefovich yuzefovich added the C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. label Jan 24, 2022
@blathers-crl blathers-crl bot added the T-kv KV Team label Jan 24, 2022
yuzefovich added a commit to yuzefovich/cockroach that referenced this issue Jun 30, 2022
Previously, for all incomplete requests in a batch we'd allocate new Get
and Scan requests (since - due to a known issue cockroachdb#75452 - at the moment
the lifecycle of the requests is not clearly defined, so we're not
allowed to modify them). However, we can reuse the Get requests since
they won't be ever modified (i.e. they are either complete or
incomplete, and, unlike for Scan requests, the start key won't ever be
shifted), so this commit takes advantage of this observation.

Release note: None
yuzefovich added a commit to yuzefovich/cockroach that referenced this issue Jul 6, 2022
Previously, for all incomplete requests in a batch we'd allocate new Get
and Scan requests (since - due to a known issue cockroachdb#75452 - at the moment
the lifecycle of the requests is not clearly defined, so we're not
allowed to modify them). However, we can reuse the Get requests since
they won't be ever modified (i.e. they are either complete or
incomplete, and, unlike for Scan requests, the start key won't ever be
shifted), so this commit takes advantage of this observation.

Release note: None
craig bot pushed a commit that referenced this issue Jul 6, 2022
83684: kvstreamer: reuse incomplete Get requests on resume batches r=yuzefovich a=yuzefovich

Previously, for all incomplete requests in a batch we'd allocate new Get
and Scan requests (since - due to a known issue #75452 - at the moment
the lifecycle of the requests is not clearly defined, so we're not
allowed to modify them). However, we can reuse the Get requests since
they won't be ever modified (i.e. they are either complete or
incomplete, and, unlike for Scan requests, the start key won't ever be
shifted), so this commit takes advantage of this observation.

Release note: None

83709: pkg/util/tracing: Add hidden tag group, make server responsible for sorting. r=benbardin a=benbardin

Release note: none

This moves all tags marked as "hidden" into a single tag group at the UI layer. This declutters the trace page a little bit and makes it easier to pick out more important information.

<img width="1620" alt="Screen Shot 2022-07-01 at 12 37 07 PM" src="https://user-images.githubusercontent.com/261508/176937757-bf8ac920-9e28-4908-8de4-1fbc077fd2c7.png">


83834: outliers: extract a Registry interface. r=matthewtodd a=matthewtodd

This is a pure mechanical refactoring, preparing us for #81021, where
we'll move outlier processing off of the hot execution path. The idea is
that the outside world will continue to talk to us as a Registry, but
we'll now have a seam into which we can insert some asynchrony.

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Ben Bardin <[email protected]>
Co-authored-by: Matthew Todd <[email protected]>
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-kv KV Team
Projects
None yet
Development

No branches or pull requests

1 participant