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: block on transition to multi-region if tables have custom zone configs #63071

Closed
aayushshah15 opened this issue Apr 5, 2021 · 2 comments
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker

Comments

@aayushshah15
Copy link
Contributor

aayushshah15 commented Apr 5, 2021

Address this TODO:


// TODO(#57668): check zone configurations are not set here

When attempting to transition an existing database to multi-region, we’d like to block the transition if any existing tables within the database have custom constraints, voter_constraints, num_replicas, num_voters or lease_preferences defined. We expect the user to DISCARD these existing configs before they can add their initial primary region.

Without the above, we risk clobbering the individual tables’ zone configs upon the transition, as they may not inherit attributes that, for instance, control the survivability or attributes that dictate the placement of non-voting replicas.

Lastly, we might want to permit the user to force their way into this transition if they have the override_multi_region_zone_config session variable set to true.

To reproduce:

root@127.0.0.1:26257/db> create table t ();

root@127.0.0.1:26257/db> alter table t configure zone using num_replicas=3, constraints='{"+region=europe-west1": 1}';

root@127.0.0.1:26257/db> alter database db configure zone using num_replicas=5, constraints='{"+region=europe-west1": 5}';

root@127.0.0.1:26257/db> alter database db set primary region "us-east1";

root@127.0.0.1:26257/db> show zone configuration for table t;
  target  |                 raw_config_sql
----------+-------------------------------------------------
  TABLE t | ALTER TABLE t CONFIGURE ZONE USING
          |     range_min_bytes = 134217728,
          |     range_max_bytes = 536870912,
          |     gc.ttlseconds = 90000,
          |     num_replicas = 3,
          |     num_voters = 3,
          |     constraints = '{+region=europe-west1: 1}', <-- ??
          |     voter_constraints = '[+region=us-east1]',
          |     lease_preferences = '[[+region=us-east1]]'
@aayushshah15 aayushshah15 added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Apr 5, 2021
@blathers-crl
Copy link

blathers-crl bot commented Apr 5, 2021

Hi @aayushshah15, please add branch-* labels to identify which branch(es) this release-blocker affects.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@otan
Copy link
Contributor

otan commented Apr 6, 2021

Lastly, we might want to permit the user to force their way into this transition if they have the override_multi_region_zone_config session variable set to true.

filing this as a separate issue

craig bot pushed a commit that referenced this issue Apr 8, 2021
63129: sql: block initial multi-region if zone configs have multi-region fields set r=ajstorm,aayushshah15 a=otan

Refs: #63071

See individual commits for details.

Note I have not done overwriting. This is not going to be planned for 21.1 unless we deem it a GA-blocker.

63231: coldata: do not allocate wasteful memory for UUIDs r=yuzefovich a=yuzefovich

Previously, whenever we're allocating a new `Bytes` vector, we would use
64 bytes as an average element size to decide how large of a flat byte
slice to allocate initially. This is wasteful in case of Uuids because
then we know that each element will be exactly of 16 bytes. This commit
uses that knowledge to remove wasteful allocations.

Release note: None

63259: sql: add pgcode for DROP REGION on PRIMARY REGION r=ajstorm a=otan

Release note (sql change): Introduce a pgcode when attempting to DROP
REGION when the the region being dropped is the PRIMARY REGION.

63268: sql: deflake test with statement_timeout r=RaduBerinde a=RaduBerinde

I saw a CI failure in this test, caused by the `SHOW` statement itself
hitting the 100ms timeout. This points to something being unreasonably
slow on the agent; but it is easy enough to increase this arbitrary
value.

Release note: None

Co-authored-by: Oliver Tan <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Radu Berinde <[email protected]>
@otan otan closed this as completed Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. GA-blocker
Projects
None yet
Development

No branches or pull requests

2 participants