Technical Advisory 84144

On this page Carat arrow pointing down

Publication date: July 19, 2022

Description

The problem affects multi-region tables whose locality has been altered to REGIONAL BY ROW in clusters running versions v22.1.0 to v22.1.3. The problem occurs when dropping a region: the drop may proceed when instead it should have yielded an error. Any subsequent attempt at changing the locality of the table will fail with an internal error.

This can be reproduced as follows in cockroach demo --multitenant=false --global --nodes 9 --insecure --empty:

> CREATE DATABASE mr PRIMARY REGION "us-east1" REGIONS "us-west1";
> USE mr;
> CREATE TABLE kv(k INT PRIMARY KEY, v INT) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION;
> ALTER TABLE kv SET LOCALITY REGIONAL BY ROW;
> INSERT INTO kv (crdb_region, k, v) VALUES ('us-east1', 1, 1);
> INSERT INTO kv (crdb_region, k, v) VALUES ('us-west1', 2, 2);

At this point the following statement should fail but instead succeeds:

> ALTER DATABASE mr DROP REGION "us-west1";

After which the following statement fails instead of succeeding:

> ALTER TABLE kv SET LOCALITY GLOBAL;
ERROR: failed to construct index entries during backfill: error decoding 4 bytes: could not find [128] in enum "public.crdb_internal_region" representation PhysicalReps: [[64]]; LogicalReps: [us-east1] goroutine 45657 [running]:

Statement

This is resolved in CockroachDB by PRs #84339 and #84349 which ensure, respectively, that: back-references to tables using the region enum type are correctly updated in the region enum type descriptor when performing ALTER TABLE … SET LOCALITY REGIONAL BY ROW; any existing type descriptors which are already missing these back-references are updated prior to ALTER DATABASE … DROP [SUPER] REGION so as to ensure its correct behavior.

The fix has been applied to the maintenance release of CockroachDB v22.1.4.

This public issue is tracked by #84144.

Mitigation

Users of CockroachDB v22.1.0 to v22.1.3 with multi-region databases are encouraged to upgrade to the maintenance version v22.1.4 or above.

Impact

Versions v22.1.0 to v22.1.3 are affected. In these versions, multi-region tables whose locality has been altered to REGIONAL BY ROW are at risk of being corrupted.

Questions about any technical alert can be directed to our support team.


Yes No
On this page

Yes No