Repository navigation
feat(bigtable/accelerator): dispatch MutateRow and single-row ReadRow… - #20312
Conversation
…s through sessions Wires the V2 data path onto the channel scaffold: Invoke routes MutateRow and NewStream routes single-row ReadRows to a per-resource session.TableAPI opened on the channel's session.Client, translating via internal/accelerator/adapters. ReadRows dispatch is lazy — deferred to the first RecvMsg — so consumer pull rate drives when session work happens. resourcename.go validates each V2 resource name against the daemon's (project, instance) scope, rejecting cross-tenant names rather than silently rebinding them onto this daemon, and reduces the name to the leaf ID(s) session.Client expects. Change-Id: I3e81bd14ed5b675f82d7cff720f86a36e4124cd1
There was a problem hiding this comment.
Code Review
This pull request implements the dispatching logic for unary MutateRow and streaming ReadRows RPCs in the Bigtable accelerator channel, including resource name validation to prevent cross-tenant access. A potential data race was identified in the readRowsClientStream implementation because SendMsg and RecvMsg access shared fields concurrently without synchronization; adding a sync.Mutex or using atomic types is recommended to ensure thread safety.
Applies PR review feedback on the MutateRow / single-row ReadRows dispatch path: - openHandle (renamed from openSession) now has an explicit ResourceTable case and returns codes.Internal for an unknown kind rather than defaulting unknown resources onto a table. - readRowsClientStream records a terminalErr and replays it on post-completion RecvMsg calls (io.EOF on success, the aborting error otherwise) instead of always returning io.EOF, matching grpc.ClientStream and avoiding masking a failed read as clean EOF. - Narrow the stream's documented concurrency contract to sequential-only single-goroutine driving, matching its sole caller; the previous comment falsely promised concurrent SendMsg/RecvMsg was safe. - Precompute scopePrefix on Channel and turn stripScope / parse* into methods; drop the now-redundant project/instance fields, sourcing the scope-mismatch error message from scopePrefix. Change-Id: I4164b3bcdab05d39427b8d5500078c9f6182248a
Route Channel.openHandle through session.TableCache so repeated RPCs to the same resource share one warm handle instead of opening (and never closing) a fresh handle per call. Without this, a long-lived daemon accumulates session pools unbounded — one per distinct resource — since session.Client only reclaims a pool when its handle is Closed. The cache is keyed by the full V2 resource name, mirroring the classic client, and evicts handles after an idle TTL via a background sweeper. Channel.Close closes the cache before the session backend. Change-Id: Ic1dbc95d40d50645d55dc4b793cda97269526046
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements the dispatch path for unary MutateRow and streaming ReadRows RPCs in the Bigtable accelerator. It introduces a TableCache to cache and reuse per-resource session.TableAPI handles, precomputes and validates resource names against the channel's scope to prevent cross-tenant access, and implements a lazy readRowsClientStream to handle single-row reads sequentially. Additionally, comprehensive unit tests are added to verify routing, caching, scope validation, and error handling. I have no feedback to provide as there are no review comments.
🤖 I have created a release *beep* *boop* --- ## [1.53.0](bigtable/v1.52.0...bigtable/v1.53.0) (2026-08-27) ### Features * **bigtable/accelerator:** Add --user-agent flag to daemon ([#20341](#20341)) ([6b33c06](6b33c06)) * **bigtable/accelerator:** Add daemon binary with identity verification ([#20330](#20330)) ([2f9cf89](2f9cf89)) * **bigtable/accelerator:** Add proxy channel scaffold owning a sessi… ([#20310](#20310)) ([d65ca7d](d65ca7d)) * **bigtable/accelerator:** Add stdin-EOF and parent-PID lifecycle wa… ([#20328](#20328)) ([dc1c6ae](dc1c6ae)) * **bigtable/accelerator:** Add UDS server with authenticated proxy i… ([#20320](#20320)) ([a837020](a837020)) * **bigtable/accelerator:** Add V2-to-session request adapters ([#20271](#20271)) ([4cb6f16](4cb6f16)) * **bigtable/accelerator:** Authenticate UDS callers with a stdin tok… ([#20324](#20324)) ([7847ab7](7847ab7)) * **bigtable/accelerator:** Dispatch MutateRow and single-row ReadRow… ([#20312](#20312)) ([c89f336](c89f336)) * Update API sources and regenerate ([#20369](#20369)) ([bfe3aaf](bfe3aaf)) * Update sources and regenerate ([#20399](#20399)) ([a6b5cdb](a6b5cdb)) ### Bug Fixes * **bigtable/internal/transport:** Drop redundant defer p.Close() in AFE picker tests ([#20311](#20311)) ([c05b767](c05b767)) * **bigtable:** Register c2p resolver + RLS balancer for accelerator daemon DirectPath ([#20362](#20362)) ([95f372f](95f372f)) * **bigtable:** Session client — set AllowNonDefaultServiceAccount on DirectPath dial ([#20343](#20343)) ([b9c76ec](b9c76ec)) * **bigtable:** Session client — single ownership + single-flight pool loading ([#20368](#20368)) ([f4ad950](f4ad950)) * **bigtable:** Session pool — re-drive creation after a never-activated close so the consecutive-failure breaker is reachable ([#20355](#20355)) ([ee74949](ee74949)) * **bigtable:** Use composed user agent as CSM client_name ([#20383](#20383)) ([cb02335](cb02335)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…s through sessions
Wires the V2 data path onto the channel scaffold: Invoke routes MutateRow and NewStream routes single-row ReadRows to a per-resource session.TableAPI opened on the channel's session.Client, translating via internal/accelerator/adapters. ReadRows dispatch is lazy — deferred to the first RecvMsg — so consumer pull rate drives when session work happens. resourcename.go validates each V2 resource name against the daemon's (project, instance) scope, rejecting cross-tenant names rather than silently rebinding them onto this daemon, and reduces the name to the leaf ID(s) session.Client expects.
Change-Id: I3e81bd14ed5b675f82d7cff720f86a36e4124cd1