From 4d81129fc02b822978bf31a0bec915447728104f Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Tue, 6 Dec 2022 20:07:02 +0000 Subject: [PATCH] rttanalysis: don't count leasing the database desc 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 --- pkg/bench/rttanalysis/rtt_analysis_bench.go | 10 ++- .../testdata/benchmark_expectations | 90 +++++++++---------- .../testdata/benchmark_expectations | 20 ++--- 3 files changed, 64 insertions(+), 56 deletions(-) diff --git a/pkg/bench/rttanalysis/rtt_analysis_bench.go b/pkg/bench/rttanalysis/rtt_analysis_bench.go index b3479edae06f..b08b5fb8f6ae 100644 --- a/pkg/bench/rttanalysis/rtt_analysis_bench.go +++ b/pkg/bench/rttanalysis/rtt_analysis_bench.go @@ -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) diff --git a/pkg/bench/rttanalysis/testdata/benchmark_expectations b/pkg/bench/rttanalysis/testdata/benchmark_expectations index 547116b8c9d5..5e17f4f4326b 100644 --- a/pkg/bench/rttanalysis/testdata/benchmark_expectations +++ b/pkg/bench/rttanalysis/testdata/benchmark_expectations @@ -5,9 +5,9 @@ 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 @@ -15,9 +15,9 @@ exp,benchmark 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 @@ -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 @@ -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 @@ -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 diff --git a/pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations b/pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations index ac8744436595..4b277ca76ea1 100644 --- a/pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations +++ b/pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations @@ -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