Skip to content

Commit

Permalink
catalog: restrict scope of descriptor validation on write
Browse files Browse the repository at this point in the history
Previously, we performed descriptor validation at txn commit time for all
so-called "uncommitted descriptors" which includes descriptors which are
only read and remain unchanged. This commit excludes these from validation.

Release note: None
  • Loading branch information
Marius Posta committed Aug 16, 2021
1 parent 7018384 commit 83140eb
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 83 deletions.
128 changes: 64 additions & 64 deletions pkg/bench/rttanalysis/testdata/benchmark_expectations
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
exp,benchmark
19,AlterRole/alter_role_with_1_option
20,AlterRole/alter_role_with_2_options
25,AlterRole/alter_role_with_3_options
17,AlterTableAddCheckConstraint/alter_table_add_1_check_constraint
17,AlterTableAddCheckConstraint/alter_table_add_2_check_constraints
17,AlterTableAddCheckConstraint/alter_table_add_3_check_constraints
17,AlterTableAddColumn/alter_table_add_1_column
17,AlterTableAddColumn/alter_table_add_2_columns
17,AlterTableAddColumn/alter_table_add_3_columns
22,AlterTableAddForeignKey/alter_table_add_1_foreign_key
27,AlterTableAddForeignKey/alter_table_add_2_foreign_keys
32,AlterTableAddForeignKey/alter_table_add_3_foreign_keys
22,AlterTableAddForeignKey/alter_table_add_foreign_key_with_3_columns
21,AlterTableConfigureZone/alter_table_configure_zone_5_replicas
21,AlterTableConfigureZone/alter_table_configure_zone_7_replicas_
21,AlterTableConfigureZone/alter_table_configure_zone_ranges
21-22,AlterTableDropColumn/alter_table_drop_1_column
25,AlterTableDropColumn/alter_table_drop_2_columns
29,AlterTableDropColumn/alter_table_drop_3_columns
18,AlterTableDropConstraint/alter_table_drop_1_check_constraint
19,AlterTableDropConstraint/alter_table_drop_2_check_constraints
20,AlterTableDropConstraint/alter_table_drop_3_check_constraints
12-13,AlterTableSplit/alter_table_split_at_1_value
18-19,AlterTableSplit/alter_table_split_at_2_values
24-25,AlterTableSplit/alter_table_split_at_3_values
8,AlterTableUnsplit/alter_table_unsplit_at_1_value
10,AlterTableUnsplit/alter_table_unsplit_at_2_values
12,AlterTableUnsplit/alter_table_unsplit_at_3_values
21,CreateRole/create_role_with_1_option
23,CreateRole/create_role_with_2_options
24,CreateRole/create_role_with_3_options
22,CreateRole/create_role_with_no_options
22,DropDatabase/drop_database_0_tables
31,DropDatabase/drop_database_1_table
40,DropDatabase/drop_database_2_tables
49,DropDatabase/drop_database_3_tables
29,DropRole/drop_1_role
36,DropRole/drop_2_roles
43,DropRole/drop_3_roles
19,DropSequence/drop_1_sequence
26,DropSequence/drop_2_sequences
33,DropSequence/drop_3_sequences
22,DropTable/drop_1_table
32,DropTable/drop_2_tables
42,DropTable/drop_3_tables
22,DropView/drop_1_view
30,DropView/drop_2_views
38,DropView/drop_3_views
18,Grant/grant_all_on_1_table
20,Grant/grant_all_on_2_tables
22,Grant/grant_all_on_3_tables
21,GrantRole/grant_1_role
24,GrantRole/grant_2_roles
17,AlterRole/alter_role_with_1_option
18,AlterRole/alter_role_with_2_options
23,AlterRole/alter_role_with_3_options
16,AlterTableAddCheckConstraint/alter_table_add_1_check_constraint
16,AlterTableAddCheckConstraint/alter_table_add_2_check_constraints
16,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
21,AlterTableAddForeignKey/alter_table_add_1_foreign_key
26,AlterTableAddForeignKey/alter_table_add_2_foreign_keys
31,AlterTableAddForeignKey/alter_table_add_3_foreign_keys
21,AlterTableAddForeignKey/alter_table_add_foreign_key_with_3_columns
20,AlterTableConfigureZone/alter_table_configure_zone_5_replicas
20,AlterTableConfigureZone/alter_table_configure_zone_7_replicas_
20,AlterTableConfigureZone/alter_table_configure_zone_ranges
20,AlterTableDropColumn/alter_table_drop_1_column
24,AlterTableDropColumn/alter_table_drop_2_columns
28,AlterTableDropColumn/alter_table_drop_3_columns
17,AlterTableDropConstraint/alter_table_drop_1_check_constraint
18,AlterTableDropConstraint/alter_table_drop_2_check_constraints
19,AlterTableDropConstraint/alter_table_drop_3_check_constraints
11-12,AlterTableSplit/alter_table_split_at_1_value
17-18,AlterTableSplit/alter_table_split_at_2_values
23-24,AlterTableSplit/alter_table_split_at_3_values
7,AlterTableUnsplit/alter_table_unsplit_at_1_value
9,AlterTableUnsplit/alter_table_unsplit_at_2_values
11,AlterTableUnsplit/alter_table_unsplit_at_3_values
19,CreateRole/create_role_with_1_option
21,CreateRole/create_role_with_2_options
22,CreateRole/create_role_with_3_options
20,CreateRole/create_role_with_no_options
20,DropDatabase/drop_database_0_tables
29,DropDatabase/drop_database_1_table
38,DropDatabase/drop_database_2_tables
47,DropDatabase/drop_database_3_tables
27,DropRole/drop_1_role
34,DropRole/drop_2_roles
41,DropRole/drop_3_roles
18,DropSequence/drop_1_sequence
25,DropSequence/drop_2_sequences
32,DropSequence/drop_3_sequences
21,DropTable/drop_1_table
31,DropTable/drop_2_tables
41,DropTable/drop_3_tables
21,DropView/drop_1_view
29,DropView/drop_2_views
37,DropView/drop_3_views
17,Grant/grant_all_on_1_table
19,Grant/grant_all_on_2_tables
21,Grant/grant_all_on_3_tables
19,GrantRole/grant_1_role
22,GrantRole/grant_2_roles
2,ORMQueries/activerecord_type_introspection_query
2,ORMQueries/django_table_introspection_1_table
2,ORMQueries/django_table_introspection_4_tables
Expand All @@ -64,19 +64,19 @@ exp,benchmark
2,ORMQueries/pg_class
2,ORMQueries/pg_namespace
2,ORMQueries/pg_type
18,Revoke/revoke_all_on_1_table
20,Revoke/revoke_all_on_2_tables
22,Revoke/revoke_all_on_3_tables
20,RevokeRole/revoke_1_role
22,RevokeRole/revoke_2_roles
17,Revoke/revoke_all_on_1_table
19,Revoke/revoke_all_on_2_tables
21,Revoke/revoke_all_on_3_tables
18,RevokeRole/revoke_1_role
20,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
26,Truncate/truncate_1_column_0_rows
26,Truncate/truncate_1_column_1_row
26,Truncate/truncate_1_column_2_rows
26,Truncate/truncate_2_column_0_rows
26,Truncate/truncate_2_column_1_rows
26,Truncate/truncate_2_column_2_rows
25,Truncate/truncate_1_column_0_rows
25,Truncate/truncate_1_column_1_row
25,Truncate/truncate_1_column_2_rows
25,Truncate/truncate_2_column_0_rows
25,Truncate/truncate_2_column_1_rows
25,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
36 changes: 18 additions & 18 deletions pkg/ccl/benchccl/rttanalysisccl/testdata/benchmark_expectations
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
exp,benchmark
22,AlterRegions/alter_empty_database_add_region
23,AlterRegions/alter_empty_database_drop_region
22,AlterRegions/alter_populated_database_add_region
23,AlterRegions/alter_populated_database_drop_region
25,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
25,AlterPrimaryRegion/alter_empty_database_alter_primary_region
26,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
25,AlterPrimaryRegion/alter_populated_database_alter_primary_region
25,AlterSurvivalGoals/alter_empty_database_from_zone_to_region
25,AlterSurvivalGoals/alter_empty_database_from_region_to_zone
65,AlterSurvivalGoals/alter_populated_database_from_zone_to_region
65,AlterSurvivalGoals/alter_populated_database_from_region_to_zone
28,AlterTableLocality/alter_from_global_to_regional_by_table
28,AlterTableLocality/alter_from_regional_by_table_to_global
24,AlterTableLocality/alter_from_global_to_rbr
24,AlterTableLocality/alter_from_regional_by_table_to_rbr
22,AlterTableLocality/alter_from_rbr_to_regional_by_table
22,AlterTableLocality/alter_from_rbr_to_global
23,AlterPrimaryRegion/alter_empty_database_alter_primary_region
23,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
23,AlterPrimaryRegion/alter_populated_database_alter_primary_region
24,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
20,AlterRegions/alter_empty_database_add_region
21,AlterRegions/alter_empty_database_drop_region
20,AlterRegions/alter_populated_database_add_region
21,AlterRegions/alter_populated_database_drop_region
24,AlterSurvivalGoals/alter_empty_database_from_region_to_zone
24,AlterSurvivalGoals/alter_empty_database_from_zone_to_region
64,AlterSurvivalGoals/alter_populated_database_from_region_to_zone
64,AlterSurvivalGoals/alter_populated_database_from_zone_to_region
22,AlterTableLocality/alter_from_global_to_rbr
27,AlterTableLocality/alter_from_global_to_regional_by_table
20,AlterTableLocality/alter_from_rbr_to_global
20,AlterTableLocality/alter_from_rbr_to_regional_by_table
27,AlterTableLocality/alter_from_regional_by_table_to_global
22,AlterTableLocality/alter_from_regional_by_table_to_rbr
5 changes: 4 additions & 1 deletion pkg/sql/catalog/descs/kv_descriptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ func (kd *kvDescriptors) getUncommittedTables() (tables []catalog.TableDescripto
func (kd *kvDescriptors) validateUncommittedDescriptors(ctx context.Context, txn *kv.Txn) error {
descs := make([]catalog.Descriptor, 0, kd.uncommittedDescriptors.Len())
_ = kd.uncommittedDescriptors.IterateByID(func(descriptor catalog.NameEntry) error {
descs = append(descs, descriptor.(*uncommittedDescriptor).immutable)
desc := descriptor.(*uncommittedDescriptor).immutable
if desc.IsUncommittedVersion() {
descs = append(descs, desc)
}
return nil
})
if len(descs) == 0 {
Expand Down

0 comments on commit 83140eb

Please sign in to comment.