Skip to content

Commit

Permalink
rttanalysis: don't count leasing the database desc
Browse files Browse the repository at this point in the history
A bunch of rtt-analysis tests were counting a request for leasing the database
descriptor. This is not interesting. This patch makes the test framework lease
it first through a "USE" statement.

The number of KV requests required for leasing is currently mis-counted. We
count 1, but in reality it's 4. A different patch will correct the miscounting
that, at which point that would be too significant for the tests.

Release note: None
Epic: None
  • Loading branch information
andreimatei committed Dec 7, 2022
1 parent f860413 commit 4d81129
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 56 deletions.
10 changes: 9 additions & 1 deletion pkg/bench/rttanalysis/rtt_analysis_bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ func executeRoundTripTest(b testingB, tc RoundTripBenchTestCase, cc ClusterConst
// Do an extra iteration and don't record it in order to deal with effects of
// running it the first time.
for i := 0; i < b.N()+1; i++ {
sql.Exec(b, "CREATE DATABASE bench;")
sql.Exec(b, "CREATE DATABASE bench")
// Make sure the database descriptor is leased, so that tests don't count
// the leasing.
sql.Exec(b, "USE bench")
// Also force a lease on the "public" schema too.
sql.Exec(b, "CREATE TABLE bench.public.__dummy__()")
sql.Exec(b, "SELECT 1 FROM bench.public.__dummy__")
sql.Exec(b, "DROP TABLE bench.public.__dummy__")

sql.Exec(b, tc.Setup)
for _, statement := range statements {
cluster.clearStatementTrace(statement.SQL)
Expand Down
90 changes: 45 additions & 45 deletions pkg/bench/rttanalysis/testdata/benchmark_expectations
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ exp,benchmark
10,AlterTableAddCheckConstraint/alter_table_add_1_check_constraint
10,AlterTableAddCheckConstraint/alter_table_add_2_check_constraints
10,AlterTableAddCheckConstraint/alter_table_add_3_check_constraints
16,AlterTableAddColumn/alter_table_add_1_column
16,AlterTableAddColumn/alter_table_add_2_columns
16,AlterTableAddColumn/alter_table_add_3_columns
15,AlterTableAddColumn/alter_table_add_1_column
15,AlterTableAddColumn/alter_table_add_2_columns
15,AlterTableAddColumn/alter_table_add_3_columns
14,AlterTableAddForeignKey/alter_table_add_1_foreign_key
18,AlterTableAddForeignKey/alter_table_add_2_foreign_keys
22,AlterTableAddForeignKey/alter_table_add_3_foreign_keys
14,AlterTableAddForeignKey/alter_table_add_foreign_key_with_3_columns
8,AlterTableConfigureZone/alter_table_configure_zone_5_replicas
8,AlterTableConfigureZone/alter_table_configure_zone_7_replicas_
8,AlterTableConfigureZone/alter_table_configure_zone_ranges
16,AlterTableDropColumn/alter_table_drop_1_column
16,AlterTableDropColumn/alter_table_drop_2_columns
16,AlterTableDropColumn/alter_table_drop_3_columns
15,AlterTableDropColumn/alter_table_drop_1_column
15,AlterTableDropColumn/alter_table_drop_2_columns
15,AlterTableDropColumn/alter_table_drop_3_columns
10,AlterTableDropConstraint/alter_table_drop_1_check_constraint
10,AlterTableDropConstraint/alter_table_drop_2_check_constraints
10,AlterTableDropConstraint/alter_table_drop_3_check_constraints
Expand All @@ -32,7 +32,7 @@ exp,benchmark
18,CreateRole/create_role_with_3_options
13,CreateRole/create_role_with_no_options
12,DropDatabase/drop_database_0_tables
14,DropDatabase/drop_database_1_table
13,DropDatabase/drop_database_1_table
14,DropDatabase/drop_database_2_tables
15,DropDatabase/drop_database_3_tables
18,DropRole/drop_1_role
Expand All @@ -41,52 +41,52 @@ exp,benchmark
13,DropSequence/drop_1_sequence
15,DropSequence/drop_2_sequences
17,DropSequence/drop_3_sequences
14,DropTable/drop_1_table
13,DropTable/drop_1_table
15,DropTable/drop_2_tables
17,DropTable/drop_3_tables
15,DropView/drop_1_view
16,DropView/drop_2_views
16,DropView/drop_3_views
11,Grant/grant_all_on_1_table
12,Grant/grant_all_on_2_tables
12,Grant/grant_all_on_3_tables
14,DropView/drop_1_view
15,DropView/drop_2_views
15,DropView/drop_3_views
10,Grant/grant_all_on_1_table
11,Grant/grant_all_on_2_tables
11,Grant/grant_all_on_3_tables
9,GrantRole/grant_1_role
11,GrantRole/grant_2_roles
3,ORMQueries/activerecord_type_introspection_query
3,ORMQueries/django_table_introspection_1_table
3,ORMQueries/django_table_introspection_4_tables
3,ORMQueries/django_table_introspection_8_tables
2,ORMQueries/has_column_privilege_using_attnum
2,ORMQueries/has_column_privilege_using_column_name
1,ORMQueries/has_schema_privilege_1
1,ORMQueries/has_schema_privilege_3
1,ORMQueries/has_schema_privilege_5
2,ORMQueries/has_sequence_privilege_1
4,ORMQueries/has_sequence_privilege_3
6,ORMQueries/has_sequence_privilege_5
2,ORMQueries/has_table_privilege_1
4,ORMQueries/has_table_privilege_3
6,ORMQueries/has_table_privilege_5
2,ORMQueries/activerecord_type_introspection_query
2,ORMQueries/django_table_introspection_1_table
2,ORMQueries/django_table_introspection_4_tables
2,ORMQueries/django_table_introspection_8_tables
1,ORMQueries/has_column_privilege_using_attnum
1,ORMQueries/has_column_privilege_using_column_name
0,ORMQueries/has_schema_privilege_1
0,ORMQueries/has_schema_privilege_3
0,ORMQueries/has_schema_privilege_5
1,ORMQueries/has_sequence_privilege_1
3,ORMQueries/has_sequence_privilege_3
5,ORMQueries/has_sequence_privilege_5
1,ORMQueries/has_table_privilege_1
3,ORMQueries/has_table_privilege_3
5,ORMQueries/has_table_privilege_5
85,ORMQueries/hasura_column_descriptions
85,ORMQueries/hasura_column_descriptions_8_tables
7,ORMQueries/hasura_column_descriptions_modified
4,ORMQueries/information_schema._pg_index_position
3,ORMQueries/pg_attribute
3,ORMQueries/pg_class
10,ORMQueries/pg_is_other_temp_schema
18,ORMQueries/pg_is_other_temp_schema_multiple_times
4,ORMQueries/pg_my_temp_schema
4,ORMQueries/pg_my_temp_schema_multiple_times
4,ORMQueries/pg_namespace
3,ORMQueries/pg_type
11,Revoke/revoke_all_on_1_table
12,Revoke/revoke_all_on_2_tables
12,Revoke/revoke_all_on_3_tables
6,ORMQueries/hasura_column_descriptions_modified
3,ORMQueries/information_schema._pg_index_position
2,ORMQueries/pg_attribute
2,ORMQueries/pg_class
9,ORMQueries/pg_is_other_temp_schema
17,ORMQueries/pg_is_other_temp_schema_multiple_times
3,ORMQueries/pg_my_temp_schema
3,ORMQueries/pg_my_temp_schema_multiple_times
3,ORMQueries/pg_namespace
2,ORMQueries/pg_type
10,Revoke/revoke_all_on_1_table
11,Revoke/revoke_all_on_2_tables
11,Revoke/revoke_all_on_3_tables
9,RevokeRole/revoke_1_role
11,RevokeRole/revoke_2_roles
1,SystemDatabaseQueries/select_system.users_with_empty_database_Name
1,SystemDatabaseQueries/select_system.users_with_schema_Name
2,SystemDatabaseQueries/select_system.users_without_schema_Name
1,SystemDatabaseQueries/select_system.users_without_schema_Name
13,Truncate/truncate_1_column_0_rows
13,Truncate/truncate_1_column_1_row
13,Truncate/truncate_1_column_2_rows
Expand All @@ -95,5 +95,5 @@ exp,benchmark
13,Truncate/truncate_2_column_2_rows
1,VirtualTableQueries/select_crdb_internal.invalid_objects_with_1_fk
1,VirtualTableQueries/select_crdb_internal.tables_with_1_fk
4,VirtualTableQueries/virtual_table_cache_with_point_lookups
9,VirtualTableQueries/virtual_table_cache_with_schema_change
3,VirtualTableQueries/virtual_table_cache_with_point_lookups
8,VirtualTableQueries/virtual_table_cache_with_schema_change
20 changes: 10 additions & 10 deletions pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
exp,benchmark
11,AlterPrimaryRegion/alter_empty_database_alter_primary_region
14,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
15,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
11,AlterPrimaryRegion/alter_populated_database_alter_primary_region
15,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
11,AlterRegions/alter_empty_database_add_region
13,AlterRegions/alter_empty_database_drop_region
11,AlterRegions/alter_populated_database_add_region
13,AlterRegions/alter_populated_database_drop_region
16,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
10,AlterRegions/alter_empty_database_add_region
12,AlterRegions/alter_empty_database_drop_region
10,AlterRegions/alter_populated_database_add_region
12,AlterRegions/alter_populated_database_drop_region
11,AlterSurvivalGoals/alter_empty_database_from_region_to_zone
11,AlterSurvivalGoals/alter_empty_database_from_zone_to_region
21,AlterSurvivalGoals/alter_populated_database_from_region_to_zone
21,AlterSurvivalGoals/alter_populated_database_from_zone_to_region
14,AlterTableLocality/alter_from_global_to_rbr
13,AlterTableLocality/alter_from_global_to_rbr
12,AlterTableLocality/alter_from_global_to_regional_by_table
10,AlterTableLocality/alter_from_rbr_to_global
10,AlterTableLocality/alter_from_rbr_to_regional_by_table
9,AlterTableLocality/alter_from_rbr_to_global
9,AlterTableLocality/alter_from_rbr_to_regional_by_table
12,AlterTableLocality/alter_from_regional_by_table_to_global
14,AlterTableLocality/alter_from_regional_by_table_to_rbr
13,AlterTableLocality/alter_from_regional_by_table_to_rbr

0 comments on commit 4d81129

Please sign in to comment.