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
30.13k stars 3.81k forks source link

sql: add table dependencies api #133566

Open asg0451 opened 2 weeks ago

asg0451 commented 2 weeks ago

Add an api that lists which (system) tables are required to plan & query tables via sql Example: to query a simple table, you might need to read system.descriptor, system.zones, system.comments, system.role_members, system.users, and possibly others.

Rationale: changefeeds need to know the full set of tables that they depend on in operation so that they can protect them from GC with PTS records. Manual efforts and escalations have resulted in the above list of known dependencies, but 1) this may not be complete, and 2) this is almost guaranteed to not remain complete as development on crdb continues.

In addition to this api, we should also create some automated randomized testing that checks that the only tables utilized are the ones listed.

Ref: #128806

Jira issue: CRDB-43689

blathers-crl[bot] commented 2 weeks ago

cc @cockroachdb/cdc

fqazi commented 2 weeks ago

So, the list of tables above with system.descriptor, system.zones, system.comments, system.role_members, system.users has been stable for a few releases, but we don't have bandwidth to add an interface for this even though there is some value here. We are going to place this in our back log, lets use the manual approach until this gets done