diff --git a/pkg/ccl/backupccl/tenant_backup_nemesis_test.go b/pkg/ccl/backupccl/tenant_backup_nemesis_test.go index d226a96c8db7..47fdd0ba9362 100644 --- a/pkg/ccl/backupccl/tenant_backup_nemesis_test.go +++ b/pkg/ccl/backupccl/tenant_backup_nemesis_test.go @@ -181,7 +181,8 @@ func TestTenantBackupNemesis(t *testing.T) { return err } defer cleanupGoDB() - reg := histogram.NewRegistry(20*time.Second, "bank") + pgURL.Path = bankData.Meta().Name + reg := histogram.NewRegistry(20*time.Second, bankData.Meta().Name) ops, err := bankData.(workload.Opser).Ops(ctx, []string{pgURL.String()}, reg) if err != nil { return err diff --git a/pkg/ccl/testccl/workload/schemachange/schema_change_external_test.go b/pkg/ccl/testccl/workload/schemachange/schema_change_external_test.go index a6706ae70af0..afde91961108 100644 --- a/pkg/ccl/testccl/workload/schemachange/schema_change_external_test.go +++ b/pkg/ccl/testccl/workload/schemachange/schema_change_external_test.go @@ -100,6 +100,7 @@ func TestWorkload(t *testing.T) { pgURL, cleanup := sqlutils.PGUrl(t, tc.Server(0).AdvSQLAddr(), t.Name(), url.User("testuser")) defer cleanup() + pgURL.Path = wl.Meta().Name const concurrency = 2 require.NoError(t, wl.Flags().Parse([]string{ diff --git a/pkg/ccl/workloadccl/roachmartccl/roachmart.go b/pkg/ccl/workloadccl/roachmartccl/roachmart.go index e3fcefa4d13d..1e50b9d7e18d 100644 --- a/pkg/ccl/workloadccl/roachmartccl/roachmart.go +++ b/pkg/ccl/workloadccl/roachmartccl/roachmart.go @@ -206,10 +206,6 @@ func (m *roachmart) Tables() []workload.Table { func (m *roachmart) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(m, m.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/cli/democluster/demo_cluster.go b/pkg/cli/democluster/demo_cluster.go index 6acc1b42e000..47698f5dae0f 100644 --- a/pkg/cli/democluster/demo_cluster.go +++ b/pkg/cli/democluster/demo_cluster.go @@ -1716,7 +1716,7 @@ func (c *transientCluster) SetupWorkload(ctx context.Context) error { if err != nil { return err } - sqlURLs = append(sqlURLs, sqlURL.ToPQ().String()) + sqlURLs = append(sqlURLs, sqlURL.WithDatabase(gen.Meta().Name).ToPQ().String()) } if err := c.runWorkload(ctx, c.demoCtx.WorkloadGenerator, sqlURLs); err != nil { return errors.Wrapf(err, "starting background workload") diff --git a/pkg/workload/bank/bank.go b/pkg/workload/bank/bank.go index e30e009aa425..865c96c5a2d6 100644 --- a/pkg/workload/bank/bank.go +++ b/pkg/workload/bank/bank.go @@ -182,10 +182,6 @@ func (b *bank) Tables() []workload.Table { func (b *bank) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(b, b.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/bulkingest/bulkingest.go b/pkg/workload/bulkingest/bulkingest.go index 6946e5e2a990..4bc745ea26dd 100644 --- a/pkg/workload/bulkingest/bulkingest.go +++ b/pkg/workload/bulkingest/bulkingest.go @@ -183,10 +183,6 @@ func (w *bulkingest) Tables() []workload.Table { func (w *bulkingest) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/connectionlatency/connectionlatency.go b/pkg/workload/connectionlatency/connectionlatency.go index cf6d8747140e..f9f8f14b5d6d 100644 --- a/pkg/workload/connectionlatency/connectionlatency.go +++ b/pkg/workload/connectionlatency/connectionlatency.go @@ -66,11 +66,6 @@ func (c *connectionLatency) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { ql := workload.QueryLoad{} - _, err := workload.SanitizeUrls(c, c.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } - for _, url := range urls { op := &connectionOp{ url: url, diff --git a/pkg/workload/indexes/indexes.go b/pkg/workload/indexes/indexes.go index 4533b048ea80..140b5dbb309e 100644 --- a/pkg/workload/indexes/indexes.go +++ b/pkg/workload/indexes/indexes.go @@ -162,10 +162,6 @@ func (w *indexes) Tables() []workload.Table { func (w *indexes) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } cfg := workload.NewMultiConnPoolCfgFromFlags(w.connFlags) cfg.MaxTotalConnections = w.connFlags.Concurrency + 1 mcp, err := workload.NewMultiConnPool(ctx, cfg, urls...) diff --git a/pkg/workload/insights/insights.go b/pkg/workload/insights/insights.go index d17752430ab7..5d3601f7c942 100644 --- a/pkg/workload/insights/insights.go +++ b/pkg/workload/insights/insights.go @@ -214,10 +214,6 @@ func (b *insights) Tables() []workload.Table { func (b *insights) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(b, b.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/jsonload/json.go b/pkg/workload/jsonload/json.go index 2ca7c0a8f9bd..d8df1e061bfa 100644 --- a/pkg/workload/jsonload/json.go +++ b/pkg/workload/jsonload/json.go @@ -137,10 +137,6 @@ func (w *jsonLoad) Tables() []workload.Table { func (w *jsonLoad) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/kv/kv.go b/pkg/workload/kv/kv.go index 4402b01998c6..465e36034fa0 100644 --- a/pkg/workload/kv/kv.go +++ b/pkg/workload/kv/kv.go @@ -449,10 +449,6 @@ func (w *kv) Tables() []workload.Table { func (w *kv) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } cfg := workload.NewMultiConnPoolCfgFromFlags(w.connFlags) cfg.MaxTotalConnections = w.connFlags.Concurrency + 1 mcp, err := workload.NewMultiConnPool(ctx, cfg, urls...) diff --git a/pkg/workload/ledger/ledger.go b/pkg/workload/ledger/ledger.go index a8ffb1807a43..7466866636db 100644 --- a/pkg/workload/ledger/ledger.go +++ b/pkg/workload/ledger/ledger.go @@ -182,10 +182,6 @@ func (w *ledger) Tables() []workload.Table { func (w *ledger) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/movr/workload.go b/pkg/workload/movr/workload.go index d05c43349c66..ee8cb4b9c2d7 100644 --- a/pkg/workload/movr/workload.go +++ b/pkg/workload/movr/workload.go @@ -303,10 +303,6 @@ func (m *movr) Ops( m.fakerOnce.Do(func() { m.faker = faker.NewFaker() }) - _, err := workload.SanitizeUrls(m, m.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } ql := workload.QueryLoad{} db, err := workload.NewRoundRobinDB(urls) if err != nil { diff --git a/pkg/workload/querybench/query_bench.go b/pkg/workload/querybench/query_bench.go index c98e02824b71..e68cd99056aa 100644 --- a/pkg/workload/querybench/query_bench.go +++ b/pkg/workload/querybench/query_bench.go @@ -119,10 +119,6 @@ func (*queryBench) Tables() []workload.Table { func (g *queryBench) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(g, g.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/querylog/querylog.go b/pkg/workload/querylog/querylog.go index 15135b1336ff..b5acb6356569 100644 --- a/pkg/workload/querylog/querylog.go +++ b/pkg/workload/querylog/querylog.go @@ -176,10 +176,6 @@ func (w *querylog) Hooks() workload.Hooks { func (w *querylog) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/queue/queue.go b/pkg/workload/queue/queue.go index 12f62a1a4e85..1fa60cedca5a 100644 --- a/pkg/workload/queue/queue.go +++ b/pkg/workload/queue/queue.go @@ -75,10 +75,6 @@ func (w *queue) Tables() []workload.Table { func (w *queue) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/rand/rand.go b/pkg/workload/rand/rand.go index c6b58157e887..200a26f5d219 100644 --- a/pkg/workload/rand/rand.go +++ b/pkg/workload/rand/rand.go @@ -150,10 +150,6 @@ func typeForOid(db *gosql.DB, typeOid oid.Oid, tableName, columnName string) (*t func (w *random) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (ql workload.QueryLoad, retErr error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/schemachange/schemachange.go b/pkg/workload/schemachange/schemachange.go index 0c91cfa11866..55c25e06d583 100644 --- a/pkg/workload/schemachange/schemachange.go +++ b/pkg/workload/schemachange/schemachange.go @@ -209,10 +209,6 @@ func (s *schemaChange) Ops( ctx, span := tracer.Start(ctx, "schemaChange.Ops") defer func() { EndSpan(span, err) }() - _, err = workload.SanitizeUrls(s, s.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } cfg := workload.NewMultiConnPoolCfgFromFlags(s.connFlags) // We will need double the concurrency, since we need watch // dog connections. There is a danger of the pool emptying on diff --git a/pkg/workload/sqlsmith/sqlsmith.go b/pkg/workload/sqlsmith/sqlsmith.go index 88070741ebf8..dcb0080c5520 100644 --- a/pkg/workload/sqlsmith/sqlsmith.go +++ b/pkg/workload/sqlsmith/sqlsmith.go @@ -134,10 +134,6 @@ func (g *sqlSmith) Ops( if err := g.validateErrorSetting(); err != nil { return workload.QueryLoad{}, err } - _, err := workload.SanitizeUrls(g, g.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/sqlstats/sqlstats.go b/pkg/workload/sqlstats/sqlstats.go index 02f7de93b1b2..32f3f034bf30 100644 --- a/pkg/workload/sqlstats/sqlstats.go +++ b/pkg/workload/sqlstats/sqlstats.go @@ -135,10 +135,6 @@ func genPermutations() *gen { func (s *sqlStats) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(s, s.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/tpcc/tpcc.go b/pkg/workload/tpcc/tpcc.go index 53f4d6a43e5e..ae4a650bab45 100644 --- a/pkg/workload/tpcc/tpcc.go +++ b/pkg/workload/tpcc/tpcc.go @@ -746,10 +746,6 @@ func (w *tpcc) Ops( w.txCounters = setupTPCCMetrics(reg.Registerer()) } - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } if err := workload.SetDefaultIsolationLevel(urls, w.isoLevel); err != nil { return workload.QueryLoad{}, err } diff --git a/pkg/workload/tpccchecks/checks_generator.go b/pkg/workload/tpccchecks/checks_generator.go index cf0f399eecd0..7c19bb55491c 100644 --- a/pkg/workload/tpccchecks/checks_generator.go +++ b/pkg/workload/tpccchecks/checks_generator.go @@ -102,12 +102,9 @@ func (*tpccChecks) Meta() workload.Meta { func (w *tpccChecks) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, errors.Wrapf(err, "could not sanitize urls %v", urls) - } dbs := make([]*gosql.DB, len(urls)) for i, url := range urls { + var err error dbs[i], err = gosql.Open(`cockroach`, url) if err != nil { return workload.QueryLoad{}, errors.Wrapf(err, "failed to dial %s", url) diff --git a/pkg/workload/tpcds/tpcds.go b/pkg/workload/tpcds/tpcds.go index 0eed35cccf27..bf6f5491b1fc 100644 --- a/pkg/workload/tpcds/tpcds.go +++ b/pkg/workload/tpcds/tpcds.go @@ -264,10 +264,6 @@ func (w *tpcds) Tables() []workload.Table { func (w *tpcds) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/tpch/tpch.go b/pkg/workload/tpch/tpch.go index a59255ce3645..bfc0f3b42cc2 100644 --- a/pkg/workload/tpch/tpch.go +++ b/pkg/workload/tpch/tpch.go @@ -298,10 +298,6 @@ func (w *tpch) Tables() []workload.Table { func (w *tpch) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(w, w.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/ttllogger/ttllogger.go b/pkg/workload/ttllogger/ttllogger.go index 62a707f2e687..ccf6507c05b0 100644 --- a/pkg/workload/ttllogger/ttllogger.go +++ b/pkg/workload/ttllogger/ttllogger.go @@ -86,10 +86,6 @@ var logChars = []rune("abdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !.") func (l *ttlLogger) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(l, l.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } db, err := gosql.Open(`cockroach`, strings.Join(urls, ` `)) if err != nil { return workload.QueryLoad{}, err diff --git a/pkg/workload/ycsb/ycsb.go b/pkg/workload/ycsb/ycsb.go index 8c571e72a5f4..328b8452c423 100644 --- a/pkg/workload/ycsb/ycsb.go +++ b/pkg/workload/ycsb/ycsb.go @@ -381,10 +381,6 @@ func (g *ycsb) Tables() []workload.Table { func (g *ycsb) Ops( ctx context.Context, urls []string, reg *histogram.Registry, ) (workload.QueryLoad, error) { - _, err := workload.SanitizeUrls(g, g.connFlags.DBOverride, urls) - if err != nil { - return workload.QueryLoad{}, err - } if err := workload.SetDefaultIsolationLevel(urls, g.isoLevel); err != nil { return workload.QueryLoad{}, err } @@ -442,6 +438,7 @@ func (g *ycsb) Ops( rowCounter := NewAcknowledgedCounter((uint64)(g.recordCount)) var requestGen randGenerator + var err error requestGenRng := rand.New(rand.NewSource(RandomSeed.Seed())) switch strings.ToLower(g.requestDistribution) { case "zipfian":