@@ -9,27 +9,18 @@ import (
9
9
context "context"
10
10
11
11
roachpb "github.com/cockroachdb/cockroach/pkg/roachpb"
12
+ "github.com/cockroachdb/cockroach/pkg/rpc/nodedialer"
12
13
"github.com/cockroachdb/cockroach/pkg/rpc/rpcbase"
14
+ "github.com/cockroachdb/cockroach/pkg/settings/cluster"
13
15
)
14
16
15
17
// DialDistSQLClient establishes a DRPC connection if enabled; otherwise,
16
18
// it falls back to gRPC. The established connection is used to create a
17
19
// RPCDistSQLClient.
18
20
func DialDistSQLClient (
19
- nd rpcbase. NodeDialer , ctx context.Context , nodeID roachpb.NodeID , class rpcbase.ConnectionClass ,
21
+ nd * nodedialer. Dialer , ctx context.Context , nodeID roachpb.NodeID , class rpcbase.ConnectionClass ,
20
22
) (RPCDistSQLClient , error ) {
21
- if ! rpcbase .TODODRPC {
22
- conn , err := nd .Dial (ctx , nodeID , class )
23
- if err != nil {
24
- return nil , err
25
- }
26
- return NewGRPCDistSQLClientAdapter (conn ), nil
27
- }
28
- conn , err := nd .DRPCDial (ctx , nodeID , class )
29
- if err != nil {
30
- return nil , err
31
- }
32
- return NewDRPCDistSQLClientAdapter (conn ), nil
23
+ return nodedialer .DialRPCClient (nd , ctx , nodeID , class , NewGRPCDistSQLClientAdapter , NewDRPCDistSQLClientAdapter )
33
24
}
34
25
35
26
// DialDistSQLClientNoBreaker establishes a DRPC connection if enabled;
@@ -41,17 +32,7 @@ func DialDistSQLClientNoBreaker(
41
32
ctx context.Context ,
42
33
nodeID roachpb.NodeID ,
43
34
class rpcbase.ConnectionClass ,
35
+ cs * cluster.Settings ,
44
36
) (RPCDistSQLClient , error ) {
45
- if ! rpcbase .TODODRPC {
46
- conn , err := nd .DialNoBreaker (ctx , nodeID , class )
47
- if err != nil {
48
- return nil , err
49
- }
50
- return NewGRPCDistSQLClientAdapter (conn ), nil
51
- }
52
- conn , err := nd .DRPCDialNoBreaker (ctx , nodeID , class )
53
- if err != nil {
54
- return nil , err
55
- }
56
- return NewDRPCDistSQLClientAdapter (conn ), nil
37
+ return rpcbase .DialRPCClientNoBreaker (nd , ctx , nodeID , class , NewGRPCDistSQLClientAdapter , NewDRPCDistSQLClientAdapter , cs )
57
38
}
0 commit comments