Skip to content

Commit dad0ad0

Browse files
craig[bot]herkolategancthumuluru-crdb
committed
147958: roachtest: fix close body r=golgeek,DarrylWong a=herkolategan Previously, we were attempting to close the body on a nil response. This caused a panic. On an error there is no response, hence no body to close. Epic: None Release note: None 147997: rpc,upgrade: add `NodeDialerNoBreaker` interface r=cthumuluru-crdb a=cthumuluru-crdb Currently, `NodeDialer` interface only has `Dial()` method which most code paths use. But there are also code paths that use `DialNoBreaker()` method. To support those cases, this commit adds a new interface `NodeDialerNoBreaker`. Epic: CRDB-48923 Informs: #147757 Release note: none Co-authored-by: Herko Lategan <[email protected]> Co-authored-by: Chandra Thumuluru <[email protected]>
3 parents 7eaf7a8 + 9c9434a + feb3af2 commit dad0ad0

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

pkg/cmd/roachtest/roachtestutil/profile.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ func getProfileWithTimeout(
340340
resp, err := client.Get(ctx, url)
341341
if err != nil {
342342
latestError = err
343-
resp.Body.Close()
344343
continue
345344
}
346345

pkg/rpc/rpcbase/nodedialer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@ const TODODRPC = false
2121
type NodeDialer interface {
2222
Dial(context.Context, roachpb.NodeID, ConnectionClass) (_ *grpc.ClientConn, err error)
2323
}
24+
25+
// NodeDialerNoBreaker interface defines methods for dialing peer nodes using their
26+
// node IDs. This interface is similar to NodeDialer but does not check the
27+
// breaker before dialing.
28+
type NodeDialerNoBreaker interface {
29+
DialNoBreaker(context.Context, roachpb.NodeID, ConnectionClass) (_ *grpc.ClientConn, err error)
30+
}

pkg/upgrade/upgradecluster/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ go_library(
2727
"//pkg/util/retry",
2828
"@com_github_cockroachdb_errors//:errors",
2929
"@com_github_cockroachdb_redact//:redact",
30-
"@org_golang_google_grpc//:grpc",
3130
],
3231
)
3332

pkg/upgrade/upgradecluster/cluster.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/cockroachdb/cockroach/pkg/util/retry"
2323
"github.com/cockroachdb/errors"
2424
"github.com/cockroachdb/redact"
25-
"google.golang.org/grpc"
2625
)
2726

2827
// Cluster mediates interacting with a cockroach cluster.
@@ -37,7 +36,7 @@ type ClusterConfig struct {
3736
NodeLiveness livenesspb.NodeVitalityInterface
3837

3938
// Dialer constructs connections to other nodes.
40-
Dialer NodeDialer
39+
Dialer rpcbase.NodeDialer
4140

4241
// RangeDescScanner paginates through all range descriptors.
4342
RangeDescScanner rangedesc.Scanner
@@ -50,12 +49,6 @@ type ClusterConfig struct {
5049
DB *kv.DB
5150
}
5251

53-
// NodeDialer abstracts connecting to other nodes in the cluster.
54-
type NodeDialer interface {
55-
// Dial returns a grpc connection to the given node.
56-
Dial(context.Context, roachpb.NodeID, rpcbase.ConnectionClass) (*grpc.ClientConn, error)
57-
}
58-
5952
// New constructs a new Cluster with the provided dependencies.
6053
func New(cfg ClusterConfig) *Cluster {
6154
return &Cluster{c: cfg}

pkg/upgrade/upgradecluster/helper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (n NoopDialer) Dial(
2929
return nil, nil
3030
}
3131

32-
var _ NodeDialer = NoopDialer{}
32+
var _ rpcbase.NodeDialer = NoopDialer{}
3333

3434
func TestHelperEveryNode(t *testing.T) {
3535
defer leaktest.AfterTest(t)()

pkg/upgrade/upgradecluster/tenant_cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ import (
129129
// again in the next release.
130130
type TenantCluster struct {
131131
// Dialer allows for the construction of connections to other SQL pods.
132-
Dialer NodeDialer
132+
Dialer rpcbase.NodeDialer
133133
InstanceReader *instancestorage.Reader
134134
instancesAtBump []sqlinstance.InstanceInfo
135135
DB *kv.DB
@@ -138,7 +138,7 @@ type TenantCluster struct {
138138
// TenantClusterConfig configures a TenantCluster.
139139
type TenantClusterConfig struct {
140140
// Dialer allows for the construction of connections to other SQL pods.
141-
Dialer NodeDialer
141+
Dialer rpcbase.NodeDialer
142142

143143
// InstanceReader is used to retrieve all SQL pods for a given tenant.
144144
InstanceReader *instancestorage.Reader

0 commit comments

Comments
 (0)