Skip to content

Commit

Permalink
Merge #83166
Browse files Browse the repository at this point in the history
83166: roachtest: add streamer config to tpchvec r=yuzefovich a=yuzefovich

**roachtest: disable merge queue in some TPCH tests**

This commit disables the merge queue during most of the TPCH tests. Some
of these tests are performance oriented, so we want to keep as many
things constant as possible. Also, having more ranges around gives us
better testing coverage of the distributed query execution.

Release note: None

**roachtest: add streamer config to tpchvec**

This commit refactors the `tpchvec` roachtest to introduce a new
`streamer` config which runs all TPCH queries with the streamer ON and
OFF by default. This is used to make it easier to track the performance
of the streamer as well as to catch regressions in performance in the
future (since the test will fail if OFF config is significantly faster
than ON config). At the moment, the test will fail if the streamer ON
config is slower by at least 3x than the OFF config, but over time
I plan to reducing that threshold.

Informs: #82159.

Release note: None

**roachtest: refactor tpchvec a bit**

This commit refactors `tpchvec` roachtest so that queries run in the
query-major order rather than the config-major order. Previously, we
would perform the cluster setup, run all queries on that setup, then
perform the setup for the second test config, run all queries again,
and then analyze the results. However, I believe for perf-oriented
tests it's better to run each query on all configs right away (so
that the chance of range movement was relatively low), and this
commit makes such a change. This required the removal of
`perf_no_stats` test config (which probably wasn't adding much value).

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Jun 23, 2022
2 parents ed58a72 + b5b9699 commit 8ddaad6
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 120 deletions.
4 changes: 3 additions & 1 deletion pkg/cmd/roachtest/tests/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func registerCancel(r registry.Registry) {
m := c.NewMonitor(ctx, c.All())
m.Go(func(ctx context.Context) error {
t.Status("restoring TPCH dataset for Scale Factor 1")
if err := loadTPCHDataset(ctx, t, c, 1 /* sf */, c.NewMonitor(ctx), c.All()); err != nil {
if err := loadTPCHDataset(
ctx, t, c, 1 /* sf */, c.NewMonitor(ctx), c.All(), false, /* disableMergeQueue */
); err != nil {
t.Fatal(err)
}

Expand Down
25 changes: 11 additions & 14 deletions pkg/cmd/roachtest/tests/tpc_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ func loadTPCHDataset(
sf int,
m cluster.Monitor,
roachNodes option.NodeListOption,
disableMergeQueue bool,
) error {
db := c.Conn(ctx, t.L(), roachNodes[0])
defer db.Close()

if disableMergeQueue {
if _, err := db.Exec("SET CLUSTER SETTING kv.range_merge.queue_enabled = false;"); err != nil {
t.Fatal(err)
}
}

if _, err := db.ExecContext(ctx, `USE tpch`); err == nil {
t.L().Printf("found existing tpch dataset, verifying scale factor\n")

Expand Down Expand Up @@ -98,25 +105,15 @@ func scatterTables(t test.Test, conn *gosql.DB, tableNames []string) {
}
}

// disableAutoStats disables automatic collection of statistics on the cluster.
func disableAutoStats(t test.Test, conn *gosql.DB) {
t.Status("disabling automatic collection of stats")
if _, err := conn.Exec(
`SET CLUSTER SETTING sql.stats.automatic_collection.enabled=false;`,
); err != nil {
t.Fatal(err)
}
}

// createStatsFromTables runs "CREATE STATISTICS" statement for every table in
// tableNames. It assumes that conn is already using the target database. If an
// error is encountered, the test is failed.
// createStatsFromTables runs ANALYZE statement for every table in tableNames.
// It assumes that conn is already using the target database. If an error is
// encountered, the test is failed.
func createStatsFromTables(t test.Test, conn *gosql.DB, tableNames []string) {
t.Status("collecting stats")
for _, tableName := range tableNames {
t.Status(fmt.Sprintf("creating statistics from table %q", tableName))
if _, err := conn.Exec(
fmt.Sprintf(`CREATE STATISTICS %s FROM %s;`, tableName, tableName),
fmt.Sprintf(`ANALYZE %s;`, tableName),
); err != nil {
t.Fatal(err)
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/cmd/roachtest/tests/tpcdsvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func registerTPCDSVec(r registry.Registry) {
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings())

clusterConn := c.Conn(ctx, t.L(), 1)
disableAutoStats(t, clusterConn)
t.Status("disabling automatic collection of stats")
if _, err := clusterConn.Exec(
`SET CLUSTER SETTING sql.stats.automatic_collection.enabled=false;`,
); err != nil {
t.Fatal(err)
}
t.Status("restoring TPCDS dataset for Scale Factor 1")
if _, err := clusterConn.Exec(
`RESTORE DATABASE tpcds FROM 'gs://cockroach-fixtures/workload/tpcds/scalefactor=1/backup?AUTH=implicit';`,
Expand Down
15 changes: 4 additions & 11 deletions pkg/cmd/roachtest/tests/tpch_concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ func registerTPCHConcurrency(r registry.Registry) {
c.Put(ctx, t.DeprecatedWorkload(), "./workload", c.Node(numNodes))
c.Start(ctx, t.L(), option.DefaultStartOpts(), install.MakeClusterSettings(), c.Range(1, numNodes-1))

// In order to keep more things constant throughout the different test
// runs, we disable range merges and range movements.
conn := c.Conn(ctx, t.L(), 1)
if _, err := conn.Exec("SET CLUSTER SETTING kv.allocator.min_lease_transfer_interval = '24h';"); err != nil {
t.Fatal(err)
}
if _, err := conn.Exec("SET CLUSTER SETTING kv.range_merge.queue_enabled = false;"); err != nil {
t.Fatal(err)
}

if lowerRefreshSpansBytes {
// Temporarily lower a KV setting to its previous default to confirm
// that the new value of 4MiB is, indeed, the root cause of the
Expand All @@ -58,14 +49,16 @@ func registerTPCHConcurrency(r registry.Registry) {
t.Fatal(err)
}
}

if disableStreamer {
if _, err := conn.Exec("SET CLUSTER SETTING sql.distsql.use_streamer.enabled = false;"); err != nil {
t.Fatal(err)
}
}

if err := loadTPCHDataset(ctx, t, c, 1 /* sf */, c.NewMonitor(ctx, c.Range(1, numNodes-1)), c.Range(1, numNodes-1)); err != nil {
if err := loadTPCHDataset(
ctx, t, c, 1 /* sf */, c.NewMonitor(ctx, c.Range(1, numNodes-1)),
c.Range(1, numNodes-1), true, /* disableMergeQueue */
); err != nil {
t.Fatal(err)
}
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/roachtest/tests/tpchbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func runTPCHBench(ctx context.Context, t test.Test, c cluster.Cluster, b tpchBen
m := c.NewMonitor(ctx, roachNodes)
m.Go(func(ctx context.Context) error {
t.Status("setting up dataset")
err := loadTPCHDataset(ctx, t, c, b.ScaleFactor, m, roachNodes)
err := loadTPCHDataset(
ctx, t, c, b.ScaleFactor, m, roachNodes, true, /* disableMergeQueue */
)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 8ddaad6

Please sign in to comment.