Skip to content

sql: replace dbdesc/schemadesc/typedesc Immutable types with catalog interfaces#62755

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
postamar:catalog-interfaces
Apr 8, 2021
Merged

sql: replace dbdesc/schemadesc/typedesc Immutable types with catalog interfaces#62755
craig[bot] merged 3 commits intocockroachdb:masterfrom
postamar:catalog-interfaces

Conversation

@postamar
Copy link
Copy Markdown

This follows on a similar effort for tables: #59495

Fixes #62750

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@postamar postamar force-pushed the catalog-interfaces branch 2 times, most recently from 36840ad to 0b2d203 Compare March 30, 2021 11:46
@postamar postamar marked this pull request as ready for review March 30, 2021 13:11
@postamar postamar requested review from a team and dt and removed request for a team and dt March 30, 2021 13:11
}
return ""
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two new methods replace LookupSchema, I feel this is a better way to expose the contents of the Schemas map which is otherwise quite easy to misinterpret.

func (desc *immutable) GetReferencingDescriptorID(refOrdinal int) descpb.ID {
return desc.ReferencingDescriptorIDs[refOrdinal]
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods needed to be added to catalog.TypeDescriptor but they're straightforward getters.

@postamar
Copy link
Copy Markdown
Author

Review guide: these changes are, for the most part, unremarkable. I commented on the parts of the diff which are interesting (albeit only slightly so). There are three commits, one per type, but it's not more difficult to review the whole diff IMHO.

@postamar postamar force-pushed the catalog-interfaces branch from 0b2d203 to cc8fed6 Compare March 31, 2021 14:47
@postamar
Copy link
Copy Markdown
Author

Rebased to fix merge conflict.

Copy link
Copy Markdown
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 14 files at r1, 45 of 45 files at r4, 21 of 21 files at r5, 39 of 39 files at r6.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @postamar)

@postamar postamar force-pushed the catalog-interfaces branch from cc8fed6 to 09e1a2d Compare April 7, 2021 21:49
@postamar
Copy link
Copy Markdown
Author

postamar commented Apr 7, 2021

Thanks for the review! Rebasing again, just to make sure.

Marius Posta added 2 commits April 8, 2021 09:21
This commit makes schemadesc.Immutable private and replaces that type
with catalog.SchemaDescriptor outside of that package, in an effort to
virtualize catalog types.

Partially addresses cockroachdb#62750.

Release note: None
This commit makes typedesc.Immutable private and replaces that type
with catalog.TypeDescriptor outside of that package, in an effort to
virtualize catalog types.

Partially addresses cockroachdb#62750.

Release note: None
@postamar postamar force-pushed the catalog-interfaces branch from 09e1a2d to 710e33a Compare April 8, 2021 13:24
@postamar
Copy link
Copy Markdown
Author

postamar commented Apr 8, 2021

Fixed merge conflict.

This commit makes dbdesc.Immutable private and replaces that type
with catalog.DatabaseDescriptor outside of that package, in an effort to
virtualize catalog types.

Partially addresses cockroachdb#62750.

Release note: None
@postamar postamar force-pushed the catalog-interfaces branch from 710e33a to b33933e Compare April 8, 2021 14:15
@postamar
Copy link
Copy Markdown
Author

postamar commented Apr 8, 2021

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 8, 2021

Build succeeded:

@craig craig bot merged commit 8f3db8f into cockroachdb:master Apr 8, 2021
@postamar postamar deleted the catalog-interfaces branch April 8, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: use catalog.*Descriptor instead of (dbdesc|schemadesc|typedesc).Immutable

3 participants