cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.87k stars 3.77k forks source link

sql/catalog: build composable and well-defined catalog abstractions #64089

Open ajwerner opened 3 years ago

ajwerner commented 3 years ago

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.

Epic: CRDB-2454

Jira issue: CRDB-6887

postamar commented 1 year ago

@ajwerner correct me if I'm wrong but at this point, this boils down to:

right?

ajwerner commented 1 year ago

Yes. With the resolver interface move would be a moving of privilege checking too I believe.