Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/catalog: extract and insert catalogs across tenants to enable PCR select from standby #129441

Closed
wants to merge 3 commits into from

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Aug 21, 2024

This patch will introduce a new builtin crdb_internal.crdb_internal.setup_read_from_standby for extracting and inserting catalogs across tenants to enable PCR selects on stand by as a part of this patch we will:

  1. Introduce this new builtin and logic require to replicate all non-system tables across tenants
  2. Modify sequence code, so that selects and builtins on these work in a read only mode
  3. Add support for system tables that are needed for users/roles and table statistics.

Fixes: #129439
Epic: CRDB-37521

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@fqazi fqazi force-pushed the setupForStreaming branch 3 times, most recently from 22de23b to 5f22d95 Compare August 21, 2024 21:44
dt and others added 2 commits August 22, 2024 01:13
Previously, we had no way of replicating the catalog from a source
tenant into a destination tenant, so that the destination tenant can
read from the soruce tenant. This patch adds support for extracting and
setting up a reader catalog using crdb_internal.setup_read_from_standby

Release note: None
Epic: CRDB-37521
Fixes: cockroachdb#129439
Previously, the only physical table types that were read only were
materialized viewed. As a part of the PCR work to support reading from a
tenant we added support for replicating catalogs and inserting them w
ith external data rows. We apply the same idea to sequences, however we
are lacking runtime support. To address this, this patch makes sequence
opertions read only if external data rows exists.

Release note: None
@fqazi fqazi force-pushed the setupForStreaming branch from 5f22d95 to a6b1e2d Compare August 22, 2024 01:13
@fqazi fqazi marked this pull request as ready for review August 22, 2024 02:12
@fqazi fqazi requested review from a team as code owners August 22, 2024 02:12
@fqazi fqazi requested review from dt and a team and removed request for a team August 22, 2024 02:12
Previously, when setting up the reader catalog, we only replicated user
created descriptors. This isn't sufficient, since we need users to be
able to login / have roles enforced and we also need table statistics
for optimal query plans. To address this, this patch will modify the
reader catalog to also turn users, roles, role_members, and
table_statistics tables into materialzied views.

Release note: None
@fqazi
Copy link
Collaborator Author

fqazi commented Aug 28, 2024

Going to adjust this based on the latest document

@fqazi fqazi closed this Aug 28, 2024
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/catalog: extract and insert catalogs across tenants to enable PCR select from standby
3 participants