Skip to content

Commit

Permalink
Merge #105891
Browse files Browse the repository at this point in the history
105891: roachtest: preserve certs in multitenant_tpch r=srosenberg,herkolategan a=renatolabs

The `loadTPCHDataset` function was unconditionally removing certs when the cluster was wiped. In this commit, we add a parameter to that function to indicate if the cluster being used is `secure`; if so, we preserve the certs when wiping.

Fixes: #105880

Release note: None

Co-authored-by: Renato Costa <[email protected]>
  • Loading branch information
craig[bot] and renatolabs committed Jul 4, 2023
2 parents b467125 + 53e9992 commit 3c0d2fc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func registerCancel(r registry.Registry) {

t.Status("restoring TPCH dataset for Scale Factor 1")
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false, /* disableMergeQueue */
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false /* disableMergeQueue */, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/cmd/roachtest/tests/multitenant_tpch.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ import (
func runMultiTenantTPCH(
ctx context.Context, t test.Test, c cluster.Cluster, enableDirectScans bool, sharedProcess bool,
) {
secure := true
c.Put(ctx, t.Cockroach(), "./cockroach", c.All())
c.Put(ctx, t.DeprecatedWorkload(), "./workload", c.Node(1))
start := func() {
c.Start(ctx, t.L(), option.DefaultStartOptsNoBackups(), install.MakeClusterSettings(install.SecureOption(true)), c.All())
c.Start(ctx, t.L(), option.DefaultStartOptsNoBackups(), install.MakeClusterSettings(install.SecureOption(secure)), c.All())
}
start()

Expand All @@ -53,7 +54,7 @@ func runMultiTenantTPCH(
}
t.Status("restoring TPCH dataset for Scale Factor 1 in ", setupNames[setupIdx])
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false, /* disableMergeQueue */
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), false /* disableMergeQueue */, secure,
); err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -82,7 +83,7 @@ func runMultiTenantTPCH(

// Restart and wipe the cluster to remove advantage of the second TPCH run.
c.Stop(ctx, t.L(), option.DefaultStopOpts())
c.Wipe(ctx, false /* preserveCerts */)
c.Wipe(ctx, secure)
start()
singleTenantConn = c.Conn(ctx, t.L(), 1)
// Disable merge queue in the system tenant.
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/tests/tpc_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func loadTPCHDataset(
m cluster.Monitor,
roachNodes option.NodeListOption,
disableMergeQueue bool,
secure bool,
) (retErr error) {
if c.Spec().Cloud != spec.GCE {
t.Skip("uses gs://cockroach-fixtures; see https://github.com/cockroachdb/cockroach/issues/105968")
Expand Down Expand Up @@ -93,7 +94,7 @@ func loadTPCHDataset(
// If the scale factor was smaller than the required scale factor, wipe the
// cluster and restore.
m.ExpectDeaths(int32(c.Spec().NodeCount))
c.Wipe(ctx, false /* preserveCerts */, roachNodes)
c.Wipe(ctx, secure, roachNodes)
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), roachNodes)
m.ResetDeaths()
} else if pqErr := (*pq.Error)(nil); !(errors.As(err, &pqErr) &&
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpch_concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func registerTPCHConcurrency(r registry.Registry) {

if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx, c.Range(1, numNodes-1)),
c.Range(1, numNodes-1), true, /* disableMergeQueue */
c.Range(1, numNodes-1), true /* disableMergeQueue */, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpchbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func runTPCHBench(ctx context.Context, t test.Test, c cluster.Cluster, b tpchBen

t.Status("setting up dataset")
err := loadTPCHDataset(
ctx, t, c, conn, b.ScaleFactor, m, roachNodes, true, /* disableMergeQueue */
ctx, t, c, conn, b.ScaleFactor, m, roachNodes, true /* disableMergeQueue */, false, /* secure */
)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/tpchvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func runTPCHVec(

t.Status("restoring TPCH dataset for Scale Factor 1")
if err := loadTPCHDataset(
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), disableMergeQueue,
ctx, t, c, conn, 1 /* sf */, c.NewMonitor(ctx), c.All(), disableMergeQueue, false, /* secure */
); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 3c0d2fc

Please sign in to comment.