Skip to content

Commit

Permalink
feat(spanner): attempt DirectPath by default (#3516)
Browse files Browse the repository at this point in the history
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 bbc61ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions spanner/client.go
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions spanner/integration_test.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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...)
Expand Down

0 comments on commit bbc61ed

Please sign in to comment.