Skip to content

Commit 1d1112e

Browse files
committed
roachtest: don't specify virtual cluster in debug zips
Previously, we were always passing the system tenant when taking debug zips in case a roachtest had overriden the default virtual cluster. However, the debug zip command already attempts to fetch all virtual clusters by passing the --ccluster flag for each tenant. This behavior was suppresed due to our hard coding of the system tenant, causing all debug zips to be of the system tenant. This changes it to instead pass nothing so the url has no existing --ccluster flag.
1 parent 026f98a commit 1d1112e

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

pkg/cmd/roachtest/cluster.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,12 +1389,14 @@ func (c *clusterImpl) FetchDebugZip(
13891389
for _, node := range nodes {
13901390
pgURLOpts := roachprod.PGURLOptions{
13911391
// `cockroach debug zip` does not support non root authentication.
1392-
Auth: install.AuthRootCert,
1393-
// request the system tenant specifically in case the test
1394-
// changed the default virtual cluster.
1395-
VirtualClusterName: install.SystemInterfaceName,
1392+
Auth: install.AuthRootCert,
1393+
Secure: c.IsSecure(),
13961394
}
1397-
nodePgUrl, err := c.InternalPGUrl(ctx, l, c.Node(node), pgURLOpts)
1395+
// Use roachprod.PgURL directly as we want to bypass the default virtual cluster
1396+
// logic. The debug zip command already handles fetching all virtual clusters by passing
1397+
// the --ccluster for each tenant. Attempting to pass a --ccluster here will override
1398+
// that behavior and cause all debug zips to be of the same tenant.
1399+
urls, err := roachprod.PgURL(ctx, l, c.MakeNodes(c.Node(node)), install.CockroachNodeCertsDir, pgURLOpts)
13981400
if err != nil {
13991401
l.Printf("cluster.FetchDebugZip failed to retrieve PGUrl on node %d: %v", node, err)
14001402
continue
@@ -1409,7 +1411,7 @@ func (c *clusterImpl) FetchDebugZip(
14091411
cmd := roachtestutil.NewCommand("%s debug zip", test.DefaultCockroachPath).
14101412
Option("include-range-info").
14111413
Flag("exclude-files", fmt.Sprintf("'%s'", excludeFiles)).
1412-
Flag("url", fmt.Sprintf("'%s'", nodePgUrl[0])).
1414+
Flag("url", urls[0]).
14131415
MaybeFlag(c.IsSecure(), "certs-dir", install.CockroachNodeCertsDir).
14141416
Arg(zipName).
14151417
String()

pkg/roachprod/roachprod.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,12 @@ func PgURL(
11731173
if len(urls) != len(nodes) {
11741174
return nil, errors.Errorf("have nodes %v, but urls %v from ips %v", nodes, urls, ips)
11751175
}
1176+
// We should never return an empty list of URLs as roachprod clusters always have at least
1177+
// one node. However, many callers of this function directly index into the slice returned,
1178+
// so check just in case.
1179+
if len(urls) == 0 {
1180+
return nil, errors.Newf("have nodes %v, but no urls were found", nodes)
1181+
}
11761182
return urls, nil
11771183
}
11781184

0 commit comments

Comments
 (0)