Skip to content

Commit 42b2b14

Browse files
ccl: move pkg/benchccl to pkg/bench (cockroachdb#164572)
ccl: move pkg/benchccl to pkg/bench
2 parents 8038f28 + c4e19d1 commit 42b2b14

File tree

9 files changed

+49
-102
lines changed

9 files changed

+49
-102
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@
445445
/pkg/ccl/testutilsccl/alter_* @cockroachdb/sql-foundations
446446
#!/pkg/ccl/utilccl/ @cockroachdb/unowned
447447
/pkg/ccl/workloadccl/ @cockroachdb/test-eng
448-
/pkg/ccl/benchccl/rttanalysisccl/ @cockroachdb/sql-foundations
449448
#!/pkg/clusterversion/ @cockroachdb/kv-prs-noreview @cockroachdb/dev-inf-noreview @cockroachdb/test-eng-noreview
450449
/pkg/clusterversion/cockroach_versions.go @cockroachdb/release-eng-prs @cockroachdb/upgrade-prs
451450
/pkg/cmd/allocsim/ @cockroachdb/kv-prs

pkg/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ ALL_TESTS = [
2323
"//pkg/build/starlarkutil:starlarkutil_test",
2424
"//pkg/build/util:util_test",
2525
"//pkg/build:build_test",
26-
"//pkg/ccl/benchccl/rttanalysisccl:rttanalysisccl_test",
2726
"//pkg/ccl/changefeedccl/avro:avro_test",
2827
"//pkg/ccl/changefeedccl/cdceval:cdceval_test",
2928
"//pkg/ccl/changefeedccl/cdcevent:cdcevent_test",
@@ -976,7 +975,6 @@ GO_TARGETS = [
976975
"//pkg/build/util:util_test",
977976
"//pkg/build:build",
978977
"//pkg/build:build_test",
979-
"//pkg/ccl/benchccl/rttanalysisccl:rttanalysisccl_test",
980978
"//pkg/ccl/changefeedccl/avro:avro",
981979
"//pkg/ccl/changefeedccl/avro:avro_test",
982980
"//pkg/ccl/changefeedccl/cdceval:cdceval",

pkg/bench/rttanalysis/BUILD.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ go_test(
4646
"grant_revoke_bench_test.go",
4747
"grant_revoke_role_bench_test.go",
4848
"jobs_test.go",
49+
"multi_region_bench_test.go",
4950
"orm_queries_bench_test.go",
5051
"rtt_analysis_test.go",
5152
"system_bench_test.go",
@@ -58,9 +59,12 @@ go_test(
5859
data = glob(["testdata/**"]),
5960
embed = [":rttanalysis"],
6061
exec_properties = {"test.Pool": "large"},
61-
shard_count = 4,
62+
shard_count = 5,
6263
deps = [
6364
"//pkg/base",
65+
"//pkg/ccl/multiregionccl",
66+
"//pkg/ccl/multiregionccl/multiregionccltestutils",
67+
"//pkg/ccl/partitionccl",
6468
"//pkg/jobs/jobspb",
6569
"//pkg/security/securityassets",
6670
"//pkg/security/securitytest",

pkg/ccl/benchccl/rttanalysisccl/multi_region_bench_test.go renamed to pkg/bench/rttanalysis/multi_region_bench_test.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Use of this software is governed by the CockroachDB Software License
44
// included in the /LICENSE file.
55

6-
package rttanalysisccl
6+
package rttanalysis
77

88
import (
99
gosql "database/sql"
@@ -13,16 +13,17 @@ import (
1313
"testing"
1414

1515
"github.com/cockroachdb/cockroach/pkg/base"
16-
"github.com/cockroachdb/cockroach/pkg/bench/rttanalysis"
16+
_ "github.com/cockroachdb/cockroach/pkg/ccl/multiregionccl"
1717
"github.com/cockroachdb/cockroach/pkg/ccl/multiregionccl/multiregionccltestutils"
18+
_ "github.com/cockroachdb/cockroach/pkg/ccl/partitionccl"
1819
"github.com/cockroachdb/cockroach/pkg/testutils/pgurlutils"
1920
)
2021

2122
const numNodes = 4
2223

2324
// RunRoundTripBenchmarkMultiRegion sets up a multi-region db run the RoundTripBenchTestCase test cases
2425
// and counts how many round trips the Stmt specified by the test case performs.
25-
var reg = rttanalysis.NewRegistry(numNodes, rttanalysis.MakeClusterConstructor(func(
26+
var multiRegionReg = NewRegistry(numNodes, MakeClusterConstructor(func(
2627
tb testing.TB, knobs base.TestingKnobs,
2728
) (*gosql.DB, *gosql.DB, func()) {
2829
cluster, _, cleanup := multiregionccltestutils.TestingCreateMultiRegionCluster(
@@ -43,7 +44,7 @@ var reg = rttanalysis.NewRegistry(numNodes, rttanalysis.MakeClusterConstructor(f
4344
tb.Fatal(err)
4445
}
4546
url, testuserCleanup := pgurlutils.PGUrl(
46-
tb, cluster.Server(0).ApplicationLayer().AdvSQLAddr(), "rttanalysisccl", url.User("testuser"),
47+
tb, cluster.Server(0).ApplicationLayer().AdvSQLAddr(), "rttanalysis", url.User("testuser"),
4748
)
4849
conn, err := gosql.Open("postgres", url.String())
4950
if err != nil {
@@ -55,7 +56,7 @@ var reg = rttanalysis.NewRegistry(numNodes, rttanalysis.MakeClusterConstructor(f
5556
}
5657
}))
5758

58-
func TestBenchmarkExpectation(t *testing.T) { reg.RunExpectations(t) }
59+
func TestMultiRegionBenchmarkExpectation(t *testing.T) { multiRegionReg.RunExpectations(t) }
5960

6061
const (
6162
multipleTableFixture = `
@@ -105,9 +106,9 @@ USE test;`)
105106
return b.String()
106107
}
107108

108-
func BenchmarkAlterRegions(b *testing.B) { reg.Run(b) }
109+
func BenchmarkAlterRegions(b *testing.B) { multiRegionReg.Run(b) }
109110
func init() {
110-
reg.Register("AlterRegions", []rttanalysis.RoundTripBenchTestCase{
111+
multiRegionReg.Register("AlterRegions", []RoundTripBenchTestCase{
111112
{
112113
Name: "alter empty database add region",
113114
Setup: `CREATE DATABASE test PRIMARY REGION "us-east1"`,
@@ -135,9 +136,9 @@ func init() {
135136
})
136137
}
137138

138-
func BenchmarkAlterPrimaryRegion(b *testing.B) { reg.Run(b) }
139+
func BenchmarkAlterPrimaryRegion(b *testing.B) { multiRegionReg.Run(b) }
139140
func init() {
140-
reg.Register("AlterPrimaryRegion", []rttanalysis.RoundTripBenchTestCase{
141+
multiRegionReg.Register("AlterPrimaryRegion", []RoundTripBenchTestCase{
141142
{
142143
Name: "alter empty database set initial primary region",
143144
Setup: "CREATE DATABASE test",
@@ -178,9 +179,9 @@ CREATE TABLE test10 (p int);
178179
})
179180
}
180181

181-
func BenchmarkAlterSurvivalGoals(b *testing.B) { reg.Run(b) }
182+
func BenchmarkAlterSurvivalGoals(b *testing.B) { multiRegionReg.Run(b) }
182183
func init() {
183-
reg.Register("AlterSurvivalGoals", []rttanalysis.RoundTripBenchTestCase{
184+
multiRegionReg.Register("AlterSurvivalGoals", []RoundTripBenchTestCase{
184185
{
185186
Name: "alter empty database from zone to region",
186187
Setup: `CREATE DATABASE test PRIMARY REGION "us-east1" REGIONS "us-east2","us-east3"`,
@@ -209,9 +210,9 @@ ALTER DATABASE test SURVIVE REGION FAILURE`,
209210
})
210211
}
211212

212-
func BenchmarkAlterTableLocality(b *testing.B) { reg.Run(b) }
213+
func BenchmarkAlterTableLocality(b *testing.B) { multiRegionReg.Run(b) }
213214
func init() {
214-
reg.Register("AlterTableLocality", []rttanalysis.RoundTripBenchTestCase{
215+
multiRegionReg.Register("AlterTableLocality", []RoundTripBenchTestCase{
215216
{
216217
Name: "alter from global to regional by table",
217218
Setup: `
@@ -275,9 +276,9 @@ CREATE TABLE test (p int) WITH (schema_locked = false) LOCALITY REGIONAL BY ROW;
275276
})
276277
}
277278

278-
func BenchmarkVirtualTableQueries(b *testing.B) { reg.Run(b) }
279+
func BenchmarkMultiRegionVirtualTableQueries(b *testing.B) { multiRegionReg.Run(b) }
279280
func init() {
280-
reg.Register("VirtualTableQueries", []rttanalysis.RoundTripBenchTestCase{
281+
multiRegionReg.Register("MultiRegionVirtualTableQueries", []RoundTripBenchTestCase{
281282
{
282283
Name: "select from crdb_internal.zones (10 tables)",
283284
Setup: multipleTableFixtures(10),

pkg/bench/rttanalysis/testdata/benchmark_expectations

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
exp,benchmark
2+
14,"Discard/DISCARD_ALL,_1_tables_in_1_db"
3+
19,"Discard/DISCARD_ALL,_2_tables_in_2_dbs"
4+
0,"Discard/DISCARD_ALL,_no_tables"
5+
12-14,AlterPrimaryRegion/alter_empty_database_alter_primary_region
6+
16,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
7+
12-14,AlterPrimaryRegion/alter_populated_database_alter_primary_region
8+
18,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
9+
11,AlterRegions/alter_empty_database_add_region
10+
12-16,AlterRegions/alter_empty_database_drop_region
11+
13,AlterRegions/alter_populated_database_add_region
12+
16,AlterRegions/alter_populated_database_drop_region
213
12,AlterRole/alter_role_with_1_option
314
15,AlterRole/alter_role_with_2_options
415
19,AlterRole/alter_role_with_3_options
16+
12,AlterSurvivalGoals/alter_empty_database_from_region_to_zone
17+
12,AlterSurvivalGoals/alter_empty_database_from_zone_to_region
18+
24,AlterSurvivalGoals/alter_populated_database_from_region_to_zone
19+
24,AlterSurvivalGoals/alter_populated_database_from_zone_to_region
520
14,AlterTableAddCheckConstraint/alter_table_add_1_check_constraint
621
14,AlterTableAddCheckConstraint/alter_table_add_2_check_constraints
722
14,AlterTableAddCheckConstraint/alter_table_add_3_check_constraints
@@ -21,6 +36,12 @@ exp,benchmark
2136
13,AlterTableDropConstraint/alter_table_drop_1_check_constraint
2237
13,AlterTableDropConstraint/alter_table_drop_2_check_constraints
2338
13,AlterTableDropConstraint/alter_table_drop_3_check_constraints
39+
18,AlterTableLocality/alter_from_global_to_rbr
40+
10,AlterTableLocality/alter_from_global_to_regional_by_table
41+
10,AlterTableLocality/alter_from_rbr_to_global
42+
10,AlterTableLocality/alter_from_rbr_to_regional_by_table
43+
10,AlterTableLocality/alter_from_regional_by_table_to_global
44+
18,AlterTableLocality/alter_from_regional_by_table_to_rbr
2445
8,AlterTableSplit/alter_table_split_at_1_value
2546
11,AlterTableSplit/alter_table_split_at_2_values
2647
14,AlterTableSplit/alter_table_split_at_3_values
@@ -32,9 +53,6 @@ exp,benchmark
3253
16,CreateRole/create_role_with_2_options
3354
19,CreateRole/create_role_with_3_options
3455
14,CreateRole/create_role_with_no_options
35-
14,"Discard/DISCARD_ALL,_1_tables_in_1_db"
36-
19,"Discard/DISCARD_ALL,_2_tables_in_2_dbs"
37-
0,"Discard/DISCARD_ALL,_no_tables"
3856
15,DropDatabase/drop_database_0_tables
3957
16,DropDatabase/drop_database_1_table
4058
16,DropDatabase/drop_database_2_tables
@@ -51,9 +69,9 @@ exp,benchmark
5169
14,DropView/drop_1_view
5270
15,DropView/drop_2_views
5371
15,DropView/drop_3_views
54-
6,GenerateObjects/generate_1000_tables_-_this_test_should_use_the_same_number_of_RTTs_as_for_10_tables
55-
9,GenerateObjects/generate_100_tables_from_template
5672
6,GenerateObjects/generate_10_tables
73+
9,GenerateObjects/generate_100_tables_from_template
74+
6,GenerateObjects/generate_1000_tables_-_this_test_should_use_the_same_number_of_RTTs_as_for_10_tables
5775
17,GenerateObjects/generate_10x10_schemas_and_tables_in_existing_db
5876
6,GenerateObjects/generate_50000_tables
5977
8,Grant/grant_all_on_1_table
@@ -73,6 +91,9 @@ exp,benchmark
7391
9-12,Jobs/resume_job
7492
3,Jobs/show_job
7593
3-5,Jobs/show_jobs
94+
10,MultiRegionVirtualTableQueries/select_from_crdb_internal.zones_(10_tables)
95+
10,MultiRegionVirtualTableQueries/select_from_crdb_internal.zones_(100_tables)
96+
10,MultiRegionVirtualTableQueries/select_from_crdb_internal.zones_(50_tables)
7697
3,ORMQueries/activerecord_type_introspection_query
7798
3-4,ORMQueries/asyncpg_types
7899
5,ORMQueries/column_descriptions_json_agg
@@ -130,8 +151,8 @@ exp,benchmark
130151
17,Truncate/truncate_2_column_1_rows
131152
17,Truncate/truncate_2_column_2_rows
132153
0,UDFResolution/select_from_udf
133-
25,UseManyRoles/use_25_roles
134154
2,UseManyRoles/use_2_roles
155+
25,UseManyRoles/use_25_roles
135156
3,VirtualTableQueries/capture_index_usage_stats
136157
2,VirtualTableQueries/select_crdb_internal.invalid_objects_with_1_fk
137158
1,VirtualTableQueries/select_crdb_internal.tables_with_1_fk

pkg/bench/rttanalysis/validate_benchmark_data_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// NOTE: If you change the number of shards, you must also update the
1616
// shard_count in BUILD.bazel to match.
17-
const shardCount = 4
17+
const shardCount = 5
1818

1919
// Validate that shardCount matches TEST_TOTAL_SHARDS environment variable at init time
2020
var _ = func() int {

pkg/ccl/benchccl/rttanalysisccl/BUILD.bazel

Lines changed: 0 additions & 26 deletions
This file was deleted.

pkg/ccl/benchccl/rttanalysisccl/bench_test.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)