Skip to content
Permalink
Browse files
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.
  • Loading branch information
mohanli-ml committed Jan 14, 2021
1 parent b8f91b7 commit bbc61ed368453b28aaf5bed627ca2499a3591f63
Showing with 1 addition and 5 deletions.
  1. +1 −0 spanner/client.go
  2. +0 −5 spanner/integration_test.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.
@@ -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...)

0 comments on commit bbc61ed

Please sign in to comment.