Skip to content

Commit bfed176

Browse files
committed
cli: remove the unused return from getClientGRPCConn
Release note: None
1 parent 8305873 commit bfed176

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

pkg/cli/debug_reset_quorum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func runDebugResetQuorum(cmd *cobra.Command, args []string) error {
5050
}
5151

5252
// Set up GRPC Connection for running ResetQuorum.
53-
cc, _, finish, err := getClientGRPCConn(ctx, serverCfg)
53+
cc, finish, err := getClientGRPCConn(ctx, serverCfg)
5454
if err != nil {
5555
log.Errorf(ctx, "connection to server failed: %v", err)
5656
return err

pkg/cli/debug_send_kv_batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func runSendKVBatch(cmd *cobra.Command, args []string) error {
171171
// Send BatchRequest.
172172
ctx, cancel := context.WithCancel(context.Background())
173173
defer cancel()
174-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
174+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
175175
if err != nil {
176176
return errors.Wrap(err, "failed to connect to the node")
177177
}

pkg/cli/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func runInit(cmd *cobra.Command, args []string) error {
4646
if err := dialAndCheckHealth(ctx); err != nil {
4747
return err
4848
}
49-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
49+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
5050
if err != nil {
5151
return err
5252
}
@@ -76,7 +76,7 @@ func dialAndCheckHealth(ctx context.Context) error {
7676
// (Attempt to) establish the gRPC connection. If that fails,
7777
// it may be that the server hasn't started to listen yet, in
7878
// which case we'll retry.
79-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
79+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
8080
if err != nil {
8181
return err
8282
}

pkg/cli/node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func runDecommissionNode(cmd *cobra.Command, args []string) error {
349349
return err
350350
}
351351

352-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
352+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
353353
if err != nil {
354354
return errors.Wrap(err, "failed to connect to the node")
355355
}
@@ -814,7 +814,7 @@ func runRecommissionNode(cmd *cobra.Command, args []string) error {
814814
return err
815815
}
816816

817-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
817+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
818818
if err != nil {
819819
return errors.Wrap(err, "failed to connect to the node")
820820
}

pkg/cli/rpc_client.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/cockroachdb/cockroach/pkg/rpc"
1818
"github.com/cockroachdb/cockroach/pkg/server"
1919
"github.com/cockroachdb/cockroach/pkg/server/serverpb"
20-
"github.com/cockroachdb/cockroach/pkg/util/hlc"
2120
"github.com/cockroachdb/cockroach/pkg/util/netutil/addr"
2221
"github.com/cockroachdb/cockroach/pkg/util/stop"
2322
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
@@ -26,13 +25,11 @@ import (
2625
"google.golang.org/grpc"
2726
)
2827

29-
// getClientGRPCConn returns a ClientConn, a Clock and a method that blocks
28+
// getClientGRPCConn returns a ClientConn and a method that blocks
3029
// until the connection (and its associated goroutines) have terminated.
31-
func getClientGRPCConn(
32-
ctx context.Context, cfg server.Config,
33-
) (*grpc.ClientConn, hlc.WallClock, func(), error) {
30+
func getClientGRPCConn(ctx context.Context, cfg server.Config) (*grpc.ClientConn, func(), error) {
3431
if ctx.Done() == nil {
35-
return nil, nil, nil, errors.New("context must be cancellable")
32+
return nil, nil, errors.New("context must be cancellable")
3633
}
3734
// 0 to disable max offset checks; this RPC context is not a member of the
3835
// cluster, so there's no need to enforce that its max offset is the same
@@ -59,14 +56,14 @@ func getClientGRPCConn(
5956
addr, err := addr.AddrWithDefaultLocalhost(cfg.AdvertiseAddr)
6057
if err != nil {
6158
stopper.Stop(ctx)
62-
return nil, nil, nil, err
59+
return nil, nil, err
6360
}
6461
// We use GRPCUnvalidatedDial() here because it does not matter
6562
// to which node we're talking to.
6663
conn, err := rpcContext.GRPCUnvalidatedDial(addr).Connect(ctx)
6764
if err != nil {
6865
stopper.Stop(ctx)
69-
return nil, nil, nil, err
66+
return nil, nil, err
7067
}
7168
stopper.AddCloser(stop.CloserFn(func() {
7269
_ = conn.Close() // nolint:grpcconnclose
@@ -76,13 +73,13 @@ func getClientGRPCConn(
7673
closer := func() {
7774
stopper.Stop(ctx)
7875
}
79-
return conn, clock, closer, nil
76+
return conn, closer, nil
8077
}
8178

8279
// getAdminClient returns an AdminClient and a closure that must be invoked
8380
// to free associated resources.
8481
func getAdminClient(ctx context.Context, cfg server.Config) (serverpb.AdminClient, func(), error) {
85-
conn, _, finish, err := getClientGRPCConn(ctx, cfg)
82+
conn, finish, err := getClientGRPCConn(ctx, cfg)
8683
if err != nil {
8784
return nil, nil, errors.Wrap(err, "failed to connect to the node")
8885
}
@@ -94,7 +91,7 @@ func getAdminClient(ctx context.Context, cfg server.Config) (serverpb.AdminClien
9491
func getStatusClient(
9592
ctx context.Context, cfg server.Config,
9693
) (serverpb.StatusClient, func(), error) {
97-
conn, _, finish, err := getClientGRPCConn(ctx, cfg)
94+
conn, finish, err := getClientGRPCConn(ctx, cfg)
9895
if err != nil {
9996
return nil, nil, errors.Wrap(err, "failed to connect to the node")
10097
}

pkg/cli/tsdump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ output.
5252
ctx, cancel := context.WithCancel(context.Background())
5353
defer cancel()
5454

55-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
55+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
5656
if err != nil {
5757
return err
5858
}

pkg/cli/zip.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func runDebugZip(cmd *cobra.Command, args []string) (retErr error) {
161161
var tenants []*serverpb.Tenant
162162
if err := func() error {
163163
s := zr.start("discovering virtual clusters")
164-
conn, _, finish, err := getClientGRPCConn(ctx, serverCfg)
164+
conn, finish, err := getClientGRPCConn(ctx, serverCfg)
165165
if err != nil {
166166
return s.fail(err)
167167
}
@@ -215,7 +215,7 @@ func runDebugZip(cmd *cobra.Command, args []string) (retErr error) {
215215
sqlAddr := tenant.SqlAddr
216216

217217
s := zr.start("establishing RPC connection to %s", cfg.AdvertiseAddr)
218-
conn, _, finish, err := getClientGRPCConn(ctx, cfg)
218+
conn, finish, err := getClientGRPCConn(ctx, cfg)
219219
if err != nil {
220220
return s.fail(err)
221221
}

0 commit comments

Comments
 (0)