Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions pkg/cmd/roachtest/tests/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ import (
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
"github.com/cockroachdb/errors"
)

// we need to hardcode the random seed when loading fixtures since
// that references a static bucket in GCS
const fixturesRandomSeed = 1

func registerCopy(r registry.Registry) {
// This test imports a fully-populated Bank table. It then creates an empty
// Bank schema. Finally, it performs a series of `INSERT ... SELECT ...`
// statements to copy all data from the first table into the second table.
runCopy := func(ctx context.Context, t test.Test, c cluster.Cluster, rows int, inTxn bool) {
// payload is the size of the payload column for each row in the Bank
// table. If this is adjusted, a new fixture may need to be generated.
// table.
const payload = 100
// rowOverheadEstimate is an estimate of the overhead of a single
// row in the Bank table, not including the size of the payload
Expand All @@ -58,10 +53,10 @@ func registerCopy(r registry.Registry) {
return errors.Wrap(err, "disabling load-based splitting")
}

t.Status("importing Bank fixture")
t.Status("importing bank table")
c.Run(ctx, option.WithNodes(c.Node(1)), fmt.Sprintf(
"./cockroach workload fixtures load bank --rows=%d --payload-bytes=%d --seed %d {pgurl:1}",
rows, payload, fixturesRandomSeed))
"./cockroach workload init bank --data-loader=IMPORT --rows=%d --payload-bytes=%d --seed 123 {pgurl:1}",
rows, payload))
if _, err := db.Exec("ALTER TABLE bank.bank RENAME TO bank.bank_orig"); err != nil {
t.Fatalf("failed to rename table: %v", err)
}
Expand Down Expand Up @@ -175,13 +170,11 @@ func registerCopy(r registry.Registry) {
for _, tc := range testcases {
tc := tc
r.Add(registry.TestSpec{
Name: fmt.Sprintf("copy/bank/rows=%d,nodes=%d,txn=%t", tc.rows, tc.nodes, tc.txn),
Owner: registry.OwnerKV,
Cluster: r.MakeClusterSpec(tc.nodes),
// Uses gs://cockroach-fixtures-us-east1. See:
// https://github.com/cockroachdb/cockroach/issues/105968
CompatibleClouds: registry.Clouds(spec.GCE, spec.Local),
Name: fmt.Sprintf("copy/bank/rows=%d,nodes=%d,txn=%t", tc.rows, tc.nodes, tc.txn),
Owner: registry.OwnerKV,
Cluster: r.MakeClusterSpec(tc.nodes),
Suites: registry.Suites(registry.Nightly),
CompatibleClouds: registry.AllClouds,
Leases: registry.MetamorphicLeases,
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
runCopy(ctx, t, c, tc.rows, tc.txn)
Expand Down