You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
145195: kv: extract KVBatch service from Internal service and remove api_drpc_hacky r=rickystewart,cthumuluru-crdb a=shubhamdhama
This change removes the old manually-created `api_drpc_hacky.go` file and
uses the properly auto-generated `api_drpc.pb.go` now that the DRPC
compiler setup is working.
We also extract the `KVBatch` service from the `Internal` service, which
has largely been an ad-hoc collection of internal RPCs. This enables:
- Easier Maintenance: Smaller services are simpler to manage and update.
- Smoother DRPC Rollout: We can move to DRPC step-by-step with these
smaller services, rather than doing `Internal` all at once.
- Subsystems get client interfaces focused only on what they need.
We also refactor `batchStreamImpl` to directly call `RecvMsg` on the
provided stream, which is enabled by the change in codegen to include a
gRPC-compatible `RecvMsg`.
---
Some context on why we use `RecvMsg`: Commit 34e3abf optimized the
`BatchStream` implementation by changing how the `BatchRequest` and its
initial `Requests` slice capacity are allocated. `RecvMsg` allows the
caller to provide a pre-allocated `BatchRequest` instance. This pattern,
when used with a pre-allocated instance of a `BatchRequest` header and
first request together, helps reduce per-message allocations compared to a
`Recv()` method that might allocate a new message object on each call
Fixes: #145179
Release note: none
Epic: CRDB-48934
Co-authored-by: Shubham Dhama <[email protected]>
0 commit comments