From bbc61ed368453b28aaf5bed627ca2499a3591f63 Mon Sep 17 00:00:00 2001 From: Mohan Li <67390330+mohanli-ml@users.noreply.github.com> Date: Thu, 14 Jan 2021 15:48:04 -0800 Subject: [PATCH] feat(spanner): attempt DirectPath by default (#3516) Update client to attempt DirectPath by default. Note that it doesn't mean that after this change client will just use DirectPath, but will call the DirectPath codepath by default. The actually enablement of DirectPath is controlled by service owner via ACL config. For now, after this change, although all users will attempt DirectPath, but they will all just fallback to the original CFE path. --- spanner/client.go | 1 + spanner/integration_test.go | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/spanner/client.go b/spanner/client.go index 1a52fa5abfd..df10dfc587b 100644 --- a/spanner/client.go +++ b/spanner/client.go @@ -178,6 +178,7 @@ func NewClientWithConfig(ctx context.Context, database string, config ClientConf ), option.WithGRPCConnectionPool(config.NumChannels), option.WithUserAgent(clientUserAgent), + internaloption.EnableDirectPath(true), } // opts will take precedence above allOpts, as the values in opts will be // applied after the values in allOpts. diff --git a/spanner/integration_test.go b/spanner/integration_test.go index 6c3a0738095..3f87716f47c 100644 --- a/spanner/integration_test.go +++ b/spanner/integration_test.go @@ -40,7 +40,6 @@ import ( instance "cloud.google.com/go/spanner/admin/instance/apiv1" "google.golang.org/api/iterator" "google.golang.org/api/option" - "google.golang.org/api/option/internaloption" adminpb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1" sppb "google.golang.org/genproto/googleapis/spanner/v1" @@ -239,8 +238,6 @@ func initIntegrationTests() (cleanup func()) { opts = append(opts, option.WithEndpoint(spannerHost)) } if dpConfig.attemptDirectPath { - // TODO(mohanli): Move EnableDirectPath internal option to client.go when DirectPath is ready for public beta. - opts = append(opts, internaloption.EnableDirectPath(true)) opts = append(opts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(peerInfo)))) } var err error @@ -3211,8 +3208,6 @@ func createClient(ctx context.Context, dbPath string, spc SessionPoolConfig) (cl opts = append(opts, option.WithEndpoint(spannerHost)) } if dpConfig.attemptDirectPath { - // TODO(mohanli): Move EnableDirectPath internal option to client.go when DirectPath is ready for public beta. - opts = append(opts, internaloption.EnableDirectPath(true)) opts = append(opts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(peerInfo)))) } client, err = NewClientWithConfig(ctx, dbPath, ClientConfig{SessionPoolConfig: spc}, opts...)