Skip to content

Commit 745acc4

Browse files
fix: explicitly disable gRPC new pickfirst. (googleapis#12206)
As seen in b/415354418, this new experimental feature introduced by grpc/grpc-go#8126 is not yet stable and may cause intermittent CloudPath fallbacks. As a user of the OSS gRPC library, CS library should explicitly disable it until the underlying issue is fixed. Co-authored-by: rahul2393 <irahul@google.com>
1 parent a7f5b16 commit 745acc4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spanner/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,15 @@ func newClientWithConfig(ctx context.Context, database string, config ClientConf
408408
ctx = trace.StartSpan(ctx, "cloud.google.com/go/spanner.NewClient")
409409
defer func() { trace.EndSpan(ctx, err) }()
410410

411+
// Explicitly disable some gRPC experiments as they are not stable yet.
412+
gRPCPickFirstEnvVarName := "GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST"
413+
if os.Getenv(gRPCPickFirstEnvVarName) == "" {
414+
err := os.Setenv(gRPCPickFirstEnvVarName, "false")
415+
if err != nil {
416+
logf(config.Logger, "Error overriding GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST to false: %v. Ignoring.", err)
417+
}
418+
}
419+
411420
// Append emulator options if SPANNER_EMULATOR_HOST has been set.
412421
if emulatorAddr := os.Getenv("SPANNER_EMULATOR_HOST"); emulatorAddr != "" {
413422
schemeRemoved := regexp.MustCompile("^(http://|https://|passthrough:///)").ReplaceAllString(emulatorAddr, "")

0 commit comments

Comments
 (0)