Currently in cockroach the access to the catalog (mapping names and IDs to their meanings) is scattered around the code-base. There are a number of layers to this access which are confusing and hard to use. Access is generally a session-level concept, though there are a variety of needs to access the catalog in asynchronous and background jobs. In order to make Transactional Schema Changes work we'll need to be able to properly orchestrate the transaction used for lookups (#56588) as well as controlling deadlines. All of this hints at a need for more abstraction both above and below the *descs.Collection.
Tons of resolution functionality exists hanging off the *sql.planner as it implements a variety of resolution-related interfaces.
This is a meta-issue for tracking a relatively large set of work related to these catalog improvements. Other work to improve the testability and reliability will be performed along the way.
[ ] Provide a mechanism to inject an abstraction for use by the descs.Collection for precise physical lookup of descriptors.
[ ] Ensure that all descriptor resolution interfaces (precise, imprecise, glob) are implemented outside of the sql package.
[ ] Ensure all descriptor access utilizes these interfaces; eliminate the possibility of buggy, low-level access.
Currently in cockroach the access to the catalog (mapping names and IDs to their meanings) is scattered around the code-base. There are a number of layers to this access which are confusing and hard to use. Access is generally a session-level concept, though there are a variety of needs to access the catalog in asynchronous and background jobs. In order to make Transactional Schema Changes work we'll need to be able to properly orchestrate the transaction used for lookups (#56588) as well as controlling deadlines. All of this hints at a need for more abstraction both above and below the
*descs.Collection
.Tons of resolution functionality exists hanging off the
*sql.planner
as it implements a variety of resolution-related interfaces. This is a meta-issue for tracking a relatively large set of work related to these catalog improvements. Other work to improve the testability and reliability will be performed along the way.sql
package.Epic: CRDB-2454
Jira issue: CRDB-6887