googleapis / googleapis/google-cloud-go
spanner: Remove usage of GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
## Client
Spanner
## Environment
Spanner client version v1.86.1
## Context
The Spanner client code (linked below) attempts to disable the new pick_first LB policy in gRPC Go by setting an environment variable: https://github.com/googleapis/google-cloud-go/blob/f1aee0d2894195ccd9689779985fa458cdcf3ef2/spanner/client.go#L411-L418
However, this attempt is ineffective. gRPC reads this environment variable into a global variable during package initialization (as seen here): https://github.com/grpc/grpc-go/blob/8ae3c0777d037ba6374de6a901dc06725e993725/internal/envconfig/envconfig.go#L59
Because the Spanner package depends on gRPC, the gRPC package's globals are initialized before the Spanner code has a chance to set the variable.
The underlying gRPC bug (https://github.com/grpc/grpc-go/pull/8615) that required this workaround was resolved in gRPC Go v1.76.0 and verified in b/415354418.
Therefore, this environment variable override is no longer necessary and can be safely removed. gRPC Go plans to remove the environment variable entirely in v1.77.0 (https://github.com/grpc/grpc-go/pull/8672).
Contributor guide
Assessment
This issue has not been assessed yet.