Skip to content

Commit

Permalink
Merge #90048
Browse files Browse the repository at this point in the history
90048: workload: add workload to trigger insight scenarios r=j82w a=j82w

This is adding a new workload that is designed to
run several bad queries that will be detected by the
insights. This workload is not public.

The list of bad queries:
1. Order by on a non-indexed column
2. Transaction updates multiple rows with a delay
3. Join on a non-indexed column
4. Contention in update by blocking a txn in the app

Release note: none

closes #90977

Release note: none

Co-authored-by: j82w <[email protected]>
  • Loading branch information
craig[bot] and j82w committed Nov 7, 2022
2 parents 532e2d5 + 9351196 commit f783b08
Show file tree
Hide file tree
Showing 9 changed files with 531 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ ALL_TESTS = [
"//pkg/workload/cli:cli_test",
"//pkg/workload/faker:faker_test",
"//pkg/workload/histogram:histogram_test",
"//pkg/workload/insights:insights_test",
"//pkg/workload/kv:kv_test",
"//pkg/workload/movr:movr_test",
"//pkg/workload/rand:rand_test",
Expand Down Expand Up @@ -2129,6 +2130,8 @@ GO_TARGETS = [
"//pkg/workload/histogram:histogram",
"//pkg/workload/histogram:histogram_test",
"//pkg/workload/indexes:indexes",
"//pkg/workload/insights:insights",
"//pkg/workload/insights:insights_test",
"//pkg/workload/jsonload:jsonload",
"//pkg/workload/kv:kv",
"//pkg/workload/kv:kv_test",
Expand Down Expand Up @@ -3076,6 +3079,7 @@ GET_X_DATA_TARGETS = [
"//pkg/workload/geospatial:get_x_data",
"//pkg/workload/histogram:get_x_data",
"//pkg/workload/indexes:get_x_data",
"//pkg/workload/insights:get_x_data",
"//pkg/workload/jsonload:get_x_data",
"//pkg/workload/kv:get_x_data",
"//pkg/workload/ledger:get_x_data",
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/workloadccl/allccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ go_library(
"//pkg/workload/examples",
"//pkg/workload/geospatial",
"//pkg/workload/indexes",
"//pkg/workload/insights",
"//pkg/workload/jsonload",
"//pkg/workload/kv",
"//pkg/workload/ledger",
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/workloadccl/allccl/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
_ "github.com/cockroachdb/cockroach/pkg/workload/examples"
_ "github.com/cockroachdb/cockroach/pkg/workload/geospatial"
_ "github.com/cockroachdb/cockroach/pkg/workload/indexes"
_ "github.com/cockroachdb/cockroach/pkg/workload/insights"
_ "github.com/cockroachdb/cockroach/pkg/workload/jsonload"
_ "github.com/cockroachdb/cockroach/pkg/workload/kv"
_ "github.com/cockroachdb/cockroach/pkg/workload/ledger"
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ go_library(
"//pkg/workload/bulkingest",
"//pkg/workload/cli",
"//pkg/workload/examples",
"//pkg/workload/insights",
"//pkg/workload/kv",
"//pkg/workload/movr",
"//pkg/workload/tpcc",
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
_ "github.com/cockroachdb/cockroach/pkg/workload/bulkingest" // registers workloads
workloadcli "github.com/cockroachdb/cockroach/pkg/workload/cli"
_ "github.com/cockroachdb/cockroach/pkg/workload/examples" // registers workloads
_ "github.com/cockroachdb/cockroach/pkg/workload/insights" // registers workloads
_ "github.com/cockroachdb/cockroach/pkg/workload/kv" // registers workloads
_ "github.com/cockroachdb/cockroach/pkg/workload/movr" // registers workloads
_ "github.com/cockroachdb/cockroach/pkg/workload/tpcc" // registers workloads
Expand Down
45 changes: 45 additions & 0 deletions pkg/workload/insights/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "insights",
srcs = ["insights.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/workload/insights",
visibility = ["//visibility:public"],
deps = [
"//pkg/col/coldata",
"//pkg/sql/types",
"//pkg/util/bufalloc",
"//pkg/util/timeutil",
"//pkg/workload",
"//pkg/workload/histogram",
"@com_github_cockroachdb_errors//:errors",
"@com_github_spf13_pflag//:pflag",
"@org_golang_x_exp//rand",
],
)

go_test(
name = "insights_test",
size = "small",
srcs = [
"insights_test.go",
"main_test.go",
],
args = ["-test.timeout=55s"],
embed = [":insights"],
deps = [
"//pkg/base",
"//pkg/security/securityassets",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/testutils/testcluster",
"//pkg/util/leaktest",
"//pkg/util/randutil",
"//pkg/workload/workloadsql",
],
)

get_x_data(name = "get_x_data")
Loading

0 comments on commit f783b08

Please sign in to comment.