diff --git a/balancer/balancer.go b/balancer/balancer.go index 67518de9a..efbeac33e 100644 --- a/balancer/balancer.go +++ b/balancer/balancer.go @@ -171,9 +171,6 @@ type PickOptions struct { // FullMethodName is the method name that NewClientStream() is called // with. The canonical format is /service/Method. FullMethodName string - // Header contains the metadata from the RPC's client header. The metadata - // should not be modified; make a copy first if needed. - Header metadata.MD } // DoneInfo contains additional information for done. diff --git a/clientconn.go b/clientconn.go index 14464bee9..9cc4b361c 100644 --- a/clientconn.go +++ b/clientconn.go @@ -42,7 +42,6 @@ import ( "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. @@ -747,10 +746,8 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { } func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, func(balancer.DoneInfo), error) { - hdr, _ := metadata.FromOutgoingContext(ctx) t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickOptions{ FullMethodName: method, - Header: hdr, }) if err != nil { return nil, nil, toRPCErr(err) diff --git a/test/balancer_test.go b/test/balancer_test.go index 5215a8461..8c007851b 100644 --- a/test/balancer_test.go +++ b/test/balancer_test.go @@ -29,7 +29,6 @@ import ( "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" testpb "google.golang.org/grpc/test/grpc_testing" "google.golang.org/grpc/testdata" @@ -46,7 +45,6 @@ type testBalancer struct { sc balancer.SubConn newSubConnOptions balancer.NewSubConnOptions - pickOptions []balancer.PickOptions doneInfo []balancer.DoneInfo } @@ -103,7 +101,6 @@ type picker struct { } func (p *picker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - p.bal.pickOptions = append(p.bal.pickOptions, opts) if p.err != nil { return nil, nil, p.err } @@ -138,13 +135,13 @@ func (s) TestCredsBundleFromBalancer(t *testing.T) { } } -func (s) TestPickAndDone(t *testing.T) { +func (s) TestDoneInfo(t *testing.T) { for _, e := range listTestEnv() { - testPickAndDone(t, e) + testDoneInfo(t, e) } } -func testPickAndDone(t *testing.T, e env) { +func testDoneInfo(t *testing.T, e env) { te := newTest(t, e) b := &testBalancer{} balancer.Register(b) @@ -164,20 +161,10 @@ func testPickAndDone(t *testing.T, e env) { if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); !reflect.DeepEqual(err, wantErr) { t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, %v", err, wantErr) } - md := metadata.Pairs("testMDKey", "testMDVal") - ctx = metadata.NewOutgoingContext(ctx, md) if _, err := tc.UnaryCall(ctx, &testpb.SimpleRequest{}); err != nil { t.Fatalf("TestService.UnaryCall(%v, _, _, _) = _, %v; want _, ", ctx, err) } - poWant := []balancer.PickOptions{ - {FullMethodName: "/grpc.testing.TestService/EmptyCall"}, - {FullMethodName: "/grpc.testing.TestService/UnaryCall", Header: md}, - } - if !reflect.DeepEqual(b.pickOptions, poWant) { - t.Fatalf("b.pickOptions = %v; want %v", b.pickOptions, poWant) - } - if len(b.doneInfo) < 1 || !reflect.DeepEqual(b.doneInfo[0].Err, wantErr) { t.Fatalf("b.doneInfo = %v; want b.doneInfo[0].Err = %v", b.doneInfo, wantErr) }