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

Add more zone config extension example #17650

Open
dikshant opened this issue Aug 11, 2023 · 5 comments
Open

Add more zone config extension example #17650

dikshant opened this issue Aug 11, 2023 · 5 comments

Comments

@dikshant
Copy link

dikshant commented Aug 11, 2023

Dikshant Adhikari (dikshant) commented:

Our docs here says:
https://www.cockroachlabs.com/docs/stable/zone-config-extensions
Has a single example showcasing failover region. We should add more. For example:

3 main US regions (east, central, west) and then 2 far regions (EU and JP). Only follower reads would be done in the far regions (EU, JP). Minimize the cross-region write latency by having the 3 US regions as voters and the 2 far regions as non-voters.

// Define database regions
CREATE DATABASE db
    PRIMARY REGION "us-west1"
    REGIONS "us-central1", "us-east1", "europe-west1", "asia-northeast1"
    SURVIVE REGION FAILURE;

CREATE TABLE regional_by_table (pk INT PRIMARY KEY) LOCALITY REGIONAL;

ALTER DATABASE db ALTER LOCALITY REGIONAL CONFIGURE ZONE USING
voter_constraints = '{+region=us-west1: 2, +region=us-central1: 2, +region=us-east1: 1}',
lease_preferences = '[[+region=us-west1], [+region=us-central1]]';

Implementing super regions

// Define database regions
ALTER DATABASE db SURVIVE REGION FAILURE;
ALTER DATABASE db ADD REGION "us-central1";
ALTER DATABASE db ADD REGION "europe-central1";
ALTER DATABASE db ADD REGION "europe-east1";
ALTER DATABASE db ALTER LOCALITY REGIONAL IN "us-east1" CONFIGURE ZONE USING
    num_replicas = 5,
    constraints = '{+region=us-east1: 2, 
                    +region=us-central1: 2, 
                    +region=us-west1: 1}',
    lease_preferences = '[[+region=us-east1], [+region=us-central1]]';

ALTER DATABASE db ALTER LOCALITY REGIONAL IN "europe-central1" CONFIGURE ZONE USING
    num_replicas = 5,
    constraints = '{+region=europe-central1: 2,
                    +region=europe-west1: 2,
                    +region=europe-east1: 1}',
    lease_preferences = '[[+region=europe-central1], [+region=europe-west1]]';

Jira Issue: DOC-8558

@dikshant dikshant changed the title Zone config extensions documentation has unsupported syntax Add more zone config extension example Aug 11, 2023
@exalate-issue-sync
Copy link

exalate-issue-sync bot commented Aug 22, 2023

Shannon Bradshaw (shannonbradshaw) commented:
Dikshant Adhikari did this emerge from a customer conversation or field concern? If so, can you link the relevant Slack thread?

@exalate-issue-sync
Copy link

Dikshant Adhikari (dikshant) commented:
Shannon Bradshaw I noticed this when I was doing the enablement slides and filed this issue since I had some extra examples at hand.

@exalate-issue-sync
Copy link

exalate-issue-sync bot commented Sep 12, 2023

Richard Loveland (rmloveland) commented:
Dikshant Adhikari I’m working on this now and have a question: for the “minimize write latency“ example, what is the addition of the regional table supposed to represent? is the idea to show that writes to that table will be against leaseholders in the US regions, while the far regions will only do follower reads against that table?

@exalate-issue-sync
Copy link

Dikshant Adhikari (dikshant) commented:
Richard Loveland yep that is exactly the point.

@exalate-issue-sync
Copy link

Richard Loveland (rmloveland) commented:
Dikshant Adhikari ok thanks for confirming. I’m modifying the example a bit to work with the {{movr}} database in {{cockroach demo}}. Will open a PR soon, will ping you on that when it’s ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants