docs icon indicating copy to clipboard operation
docs copied to clipboard

Clarify and add examples for zone config constraints with hierarchy

Open jseldess opened this issue 6 years ago • 2 comments

Jesse Seldess commented:

https://www.cockroachlabs.com/docs/stable/configure-replication-zones.html#types-of-constraints

  • Add clear explanation of syntax for multi-level constraints.
  • Add example with multi-level constraints.
  • Validate the syntax for leaseholder preferences and add example.

Question from @robert-s-lee:

ALTER PARTITION user1 OF TABLE defaultdb.usertable CONFIGURE ZONE USING constraints='[+cloud=gce,region=us-east1,zone=us-east1-b]', lease_preferences='[[+cloud=gce,region=us-east1,zone=us-east1-b]]'; ALTER PARTITION user2 OF TABLE defaultdb.usertable CONFIGURE ZONE USING constraints='[+cloud=gce,region=us-west1,zone=us-west1-b]', lease_preferences='[[+cloud=gce,region=us-west1,zone=us-west1-b]]'; ALTER PARTITION user3 OF TABLE defaultdb.usertable CONFIGURE ZONE USING constraints='[+cloud=gce,region=europe-west2,zone=europe-west2-b]', lease_preferences='[[+cloud=gce,region=europe-west2,zone=europe-west2-b]]';
Error: pq: could not validate zone config: constraints must either be required (prefixed with a '+') or prohibited (prefixed with a '-')

Jira Issue: DOC-250

jseldess avatar Mar 05 '19 14:03 jseldess

From https://github.com/cockroachdb/docs/issues/4447:

Currently today the only example of an array I could find on the page is the following: constraints = '[+ssd, -region=west]' I think it would be great to perhaps show something like:

constraints = '[+region=west, +region=central]' to make it clear how this could be used. Showing this in an alter statement down the page would also be great.

jseldess avatar Mar 07 '19 22:03 jseldess

From my understanding, constraints = '[+region=west, +region=central]' doesn't work as it will look for a node with both region set to "west" and also set to "central". Most likely no nodes will fit this constraint. You could have constraints like constraints = '[+cloud=aws, +region=central]'

rkruze avatar Mar 07 '19 23:03 rkruze