Skip to content

Commit

Permalink
Merge #93080 #93104
Browse files Browse the repository at this point in the history
93080: sql: alias tree.ParamTypes as []tree.ParamType r=mgartner a=mgartner

Epic: None

Release note: None

93104: catkv: replace StoredCatalog with cached CatalogReader r=postamar a=postamar

catkv: replace StoredCatalog with cached CatalogReader

This commit leverages the previous one and uses nstree.Catalog as the
data structure for caching all catalog data read by catkv.CatalogReader.
The StoredCatalog object is removed in favor of a cached CatalogReader
implementation.

This results in more consistent behavior when reading descriptors,
comments and zone configs.

Informs #88571.

Release note: None

----

nstree: refactor Catalog entries

This commit changes no functionality. Comments and zone configs are
joined by descriptor ID in the Catalog's by-ID btree entries.

Release note: None

Co-authored-by: Marcus Gartner <[email protected]>
Co-authored-by: Marius Posta <[email protected]>
  • Loading branch information
3 people committed Dec 9, 2022
3 parents b143dc5 + b56e6f5 + 9949508 commit 153448e
Show file tree
Hide file tree
Showing 40 changed files with 3,299 additions and 2,240 deletions.
2 changes: 2 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ ALL_TESTS = [
"//pkg/sql/catalog/descs:descs_test",
"//pkg/sql/catalog/funcdesc:funcdesc_test",
"//pkg/sql/catalog/hydrateddesc:hydrateddesc_test",
"//pkg/sql/catalog/internal/catkv:catkv_test",
"//pkg/sql/catalog/internal/validate:validate_test",
"//pkg/sql/catalog/lease:lease_test",
"//pkg/sql/catalog/multiregion:multiregion_test",
Expand Down Expand Up @@ -1404,6 +1405,7 @@ GO_TARGETS = [
"//pkg/sql/catalog/hydrateddesc:hydrateddesc_test",
"//pkg/sql/catalog/ingesting:ingesting",
"//pkg/sql/catalog/internal/catkv:catkv",
"//pkg/sql/catalog/internal/catkv:catkv_test",
"//pkg/sql/catalog/internal/validate:validate",
"//pkg/sql/catalog/internal/validate:validate_test",
"//pkg/sql/catalog/lease:lease",
Expand Down
98 changes: 49 additions & 49 deletions pkg/bench/rttanalysis/testdata/benchmark_expectations
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@ exp,benchmark
10,AlterRole/alter_role_with_1_option
13,AlterRole/alter_role_with_2_options
17,AlterRole/alter_role_with_3_options
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
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
9,AlterTableAddCheckConstraint/alter_table_add_1_check_constraint
9,AlterTableAddCheckConstraint/alter_table_add_2_check_constraints
9,AlterTableAddCheckConstraint/alter_table_add_3_check_constraints
12,AlterTableAddColumn/alter_table_add_1_column
12,AlterTableAddColumn/alter_table_add_2_columns
12,AlterTableAddColumn/alter_table_add_3_columns
13,AlterTableAddForeignKey/alter_table_add_1_foreign_key
17,AlterTableAddForeignKey/alter_table_add_2_foreign_keys
21,AlterTableAddForeignKey/alter_table_add_3_foreign_keys
13,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
10,AlterTableDropConstraint/alter_table_drop_1_check_constraint
10,AlterTableDropConstraint/alter_table_drop_2_check_constraints
10,AlterTableDropConstraint/alter_table_drop_3_check_constraints
12,AlterTableDropColumn/alter_table_drop_1_column
12,AlterTableDropColumn/alter_table_drop_2_columns
12,AlterTableDropColumn/alter_table_drop_3_columns
9,AlterTableDropConstraint/alter_table_drop_1_check_constraint
9,AlterTableDropConstraint/alter_table_drop_2_check_constraints
9,AlterTableDropConstraint/alter_table_drop_3_check_constraints
9,AlterTableSplit/alter_table_split_at_1_value
13,AlterTableSplit/alter_table_split_at_2_values
17,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
12,CreateRole/create_role_with_1_option
15,CreateRole/create_role_with_2_options
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
14,DropDatabase/drop_database_2_tables
15,DropDatabase/drop_database_3_tables
13,CreateRole/create_role_with_1_option
16,CreateRole/create_role_with_2_options
19,CreateRole/create_role_with_3_options
14,CreateRole/create_role_with_no_options
10,DropDatabase/drop_database_0_tables
11,DropDatabase/drop_database_1_table
12,DropDatabase/drop_database_2_tables
13,DropDatabase/drop_database_3_tables
18,DropRole/drop_1_role
26,DropRole/drop_2_roles
34,DropRole/drop_3_roles
13,DropSequence/drop_1_sequence
15,DropSequence/drop_2_sequences
17,DropSequence/drop_3_sequences
14,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
11,DropSequence/drop_1_sequence
12,DropSequence/drop_2_sequences
13,DropSequence/drop_3_sequences
11,DropTable/drop_1_table
12,DropTable/drop_2_tables
13,DropTable/drop_3_tables
12,DropView/drop_1_view
13,DropView/drop_2_views
13,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
11,GrantRole/grant_1_role
15,GrantRole/grant_2_roles
3,ORMQueries/activerecord_type_introspection_query
Expand All @@ -69,31 +69,31 @@ exp,benchmark
6,ORMQueries/has_table_privilege_5
85,ORMQueries/hasura_column_descriptions
85,ORMQueries/hasura_column_descriptions_8_tables
7,ORMQueries/hasura_column_descriptions_modified
6,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
9,ORMQueries/pg_is_other_temp_schema
17,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
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
13,Truncate/truncate_1_column_0_rows
13,Truncate/truncate_1_column_1_row
13,Truncate/truncate_1_column_2_rows
13,Truncate/truncate_2_column_0_rows
13,Truncate/truncate_2_column_1_rows
13,Truncate/truncate_2_column_2_rows
12,Truncate/truncate_1_column_0_rows
12,Truncate/truncate_1_column_1_row
12,Truncate/truncate_1_column_2_rows
12,Truncate/truncate_2_column_0_rows
12,Truncate/truncate_2_column_1_rows
12,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
8,VirtualTableQueries/virtual_table_cache_with_schema_change
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
11,AlterPrimaryRegion/alter_empty_database_alter_primary_region
14,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
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
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
12,AlterTableLocality/alter_from_regional_by_table_to_global
14,AlterTableLocality/alter_from_regional_by_table_to_rbr
10,AlterPrimaryRegion/alter_empty_database_alter_primary_region
12,AlterPrimaryRegion/alter_empty_database_set_initial_primary_region
10,AlterPrimaryRegion/alter_populated_database_alter_primary_region
13,AlterPrimaryRegion/alter_populated_database_set_initial_primary_region
9,AlterRegions/alter_empty_database_add_region
11,AlterRegions/alter_empty_database_drop_region
9,AlterRegions/alter_populated_database_add_region
11,AlterRegions/alter_populated_database_drop_region
10,AlterSurvivalGoals/alter_empty_database_from_region_to_zone
10,AlterSurvivalGoals/alter_empty_database_from_zone_to_region
20,AlterSurvivalGoals/alter_populated_database_from_region_to_zone
20,AlterSurvivalGoals/alter_populated_database_from_zone_to_region
12,AlterTableLocality/alter_from_global_to_rbr
11,AlterTableLocality/alter_from_global_to_regional_by_table
8,AlterTableLocality/alter_from_rbr_to_global
8,AlterTableLocality/alter_from_rbr_to_regional_by_table
11,AlterTableLocality/alter_from_regional_by_table_to_global
12,AlterTableLocality/alter_from_regional_by_table_to_rbr
8 changes: 4 additions & 4 deletions pkg/sql/catalog/catalogkeys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ const (
// ConstraintCommentType comment on a constraint.
ConstraintCommentType CommentType = 5

// maxCommentTypeValue is the max possible integer of CommentType type. Update
// this whenever a new comment type is added.
maxCommentTypeValue = ConstraintCommentType
// MaxCommentTypeValue is the max possible integer of CommentType type.
// Update this whenever a new comment type is added.
MaxCommentTypeValue = ConstraintCommentType
)

// AllCommentTypes is a slice of all valid schema comment types.
Expand All @@ -75,7 +75,7 @@ var AllCommentTypes = []CommentType{
}

func init() {
if len(AllCommentTypes) != int(maxCommentTypeValue+1) {
if len(AllCommentTypes) != int(MaxCommentTypeValue+1) {
panic("AllCommentTypes should contains all comment types.")
}
}
Expand Down
Loading

0 comments on commit 153448e

Please sign in to comment.