Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bigtable): attempt DirectPath by default #3558

Merged
merged 3 commits into from Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions bigtable/bigtable.go
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/golang/protobuf/proto"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
gtransport "google.golang.org/api/transport/grpc"
btpb "google.golang.org/genproto/googleapis/bigtable/v2"
"google.golang.org/grpc"
Expand Down Expand Up @@ -81,6 +82,9 @@ func NewClientWithConfig(ctx context.Context, project, instance string, config C
// TODO(grpc/grpc-go#1388) using connection pool without WithBlock
// can cause RPCs to fail randomly. We can delete this after the issue is fixed.
option.WithGRPCDialOption(grpc.WithBlock()))
// Attempts direct access to spanner service over gRPC to improve throughput,
// whether the attempt is allowed is totally controlled by service owner.
o = append(o, internaloption.EnableDirectPath(true))
o = append(o, opts...)
connPool, err := gtransport.DialPool(ctx, o...)
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions bigtable/export_test.go
Expand Up @@ -28,7 +28,6 @@ import (
btopt "cloud.google.com/go/bigtable/internal/option"
"cloud.google.com/go/internal/testutil"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
gtransport "google.golang.org/api/transport/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/peer"
Expand Down Expand Up @@ -269,8 +268,6 @@ func (e *ProdEnv) NewClient() (*Client, error) {
}

if e.config.AttemptDirectPath {
// TODO(mohanli): Move the EnableDirectPath internal option to bigtable.go after e2e tests are done.
clientOpts = append(clientOpts, internaloption.EnableDirectPath(true))
// For DirectPath tests, we need to add an interceptor to check the peer IP.
clientOpts = append(clientOpts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.Peer(e.peerInfo))))
}
Expand Down