cockroachdb / cockroachdb/cockroach

multi-region: Initial replica placement for a MR database appears to be wrong

Open
#107,977 0 comments 0 reactions 0 assignees View on GitHub
A-kv A-multiregion A-multitenancy S-3-ux-surprise T-kv
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

On `demo` (started with `--nodes 9`) take the following steps (note that `demo` on master defaults to multi-tenancy, so this _may_ be a multi-tenant-only issue):

* `CREATE DATABASE test PRIMARY REGION "us-east1" REGIONS "us-west1"; use test`;
* `CREATE TABLE test.global(k INT PRIMARY KEY, v INT) LOCALITY GLOBAL;`
* `SHOW REGIONS;`
* `SHOW RANGES;`

The first call to `SHOW RANGES` will return:

```
start_key | end_key | range_id | replicas | replica_localities | voting_replicas | non_voting_replicas | learner_replicas | split_enforced_until
----------------------+-----------+----------+----------+----------------------------------------------------------------------------+-----------------+---------------------+------------------+-----------------------
/Tenant/2/Table/116 | /Tenant/3 | 66 | {1,4,8} | {"region=us-east1,az=b","region=us-west1,az=a","region=europe-west1,az=c"} | {1,4,8} | {} | {} | NULL

```

Note that there's a voting replica placed in `europe-west1`, which isn't a database region. After some time, the replicas move to the right place, and a subsequent call to `SHOW RANGES` will return:

```
start_key | end_key | range_id | replicas | replica_localities | voting_replicas | non_voting_replicas | learner_replicas | split_enforced_until
----------------------+-----------+----------+-----------+-----------------------------------------------------------------------------------------------+-----------------+---------------------+------------------+-----------------------
/Tenant/2/Table/116 | /Tenant/3 | 66 | {1,2,3,4} | {"region=us-east1,az=b","region=us-east1,az=c","region=us-east1,az=d","region=us-west1,az=a"} | {1,3,2} | {4} | {} | NULL
```

This seems to be either a bug in the `SHOW RANGES` output, or in the allocator. Sending to KV for initial triage.

Jira issue: CRDB-30277
Epic: CRDB-26686

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.