Repository navigation
feat(bigtable/accelerator): add UDS server with authenticated proxy i… - #20320
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an in-process Bigtable accelerator daemon, providing a local gRPC server over a Unix Domain Socket (UDS) with lifecycle watchdogs, authentication interceptors, and proxying capabilities. It also includes comprehensive unit and integration tests, including a real end-to-end round-trip test against Cloud Bigtable. The review feedback highlights two important improvements: caching resolved gRPC method descriptors in resolveMethodIO to avoid expensive registry lookups on the hot path, and wrapping GracefulStop() with a timeout in Server.Stop() to prevent the daemon from hanging indefinitely during shutdown.
093892d to
19fe584
Compare
Serves a Channel over a Unix domain socket: binds a 0600-permissioned UDS listener and installs proxy interceptors that forward every unary and server-streaming RPC through the Channel. The token-based caller handshake, the stdin/parent-PID lifecycle watchdogs, and the end-to-end roundtrip test are layered on top in follow-up changes. Change-Id: Ia3944a6fa5a835c31e403de942058256a702f449
| // gRPC's registration contract. | ||
| btpb.RegisterBigtableServer(s.grpcServer, s.service) | ||
|
|
||
| go func() { |
There was a problem hiding this comment.
go func() {
err := s.grpcServer.Serve(s.listener)
if err != nil && !errors.Is(err, grpc.ErrServerStopped) {
log.Printf("accelerator: gRPC server exited with error: %v", err)
}
s.Stop()
}()
| listener net.Listener | ||
| shutdownChan chan struct{} | ||
| stopOnce sync.Once | ||
| StdinReader io.Reader // Configurable stdin reader for testing; nil disables stdin watchdog |
There was a problem hiding this comment.
/ ServerOption configures optional Server behavior. Options are applied
// left-to-right by NewServer; later options override earlier ones for the
// same field.
type ServerOption func(*Server)
func WithStdinReader(r io.Reader) ServerOption {
return func(s *Server) { s.stdinReader = r }
}
and apply
in
func NewServer(udsPath string, channel *Channel, opts ...ServerOption) *Server {
....
for _, opt := range opts {
opt(s)
}
}
so that it is not mutable.
Follow-up to the UDS server commit addressing PR googleapis#20320 review comments: - Drive Stop() from the Serve goroutine once Serve returns, so a self-inflicted server failure tears down the listener, channel, and socket rather than leaving a half-dead daemon behind. Stop() is idempotent, so the clean-shutdown path stays a no-op. - proxyStreamInterceptor reuses a single response message across the pump loop (proto.Reset) instead of allocating one per streamed row. gRPC marshals synchronously inside SendMsg, so reuse is safe. - StdinReader is now configured via a WithStdinReader functional option, keeping the field immutable after NewServer returns. Change-Id: Ia82461f55ba04c1046df0815418741d9cc86a497
🤖 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>
…nterceptors
Serves a Channel over a Unix domain socket with authenticated proxy interceptors that forward every RPC through the Channel, plus stdin-EOF and parent-PID watchdogs. Includes an end-to-end roundtrip test.