-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi-region: Unblock IMPORT into allowable multi-region tables
Unblock IMPORTing into allowable multi-region tables. We only support importing into GLOBAL and REGIONAL BY TABLE tables as #61133 is blocking IMPORT into any tables which have columns generated using a user defined type (which covers REGIONAL BY ROW tables, as they have the crdb_region column which is generated using the crdb_internal_region type). This commit includes tests for both IMPORT and IMPORT INTO, as well as cases which illustrate #61133 for non-multi-region tables. One thing of note is the moving of the call to ValidateTableLocalityConfig from NewTableDesc to the startExec of createTableNode. This is intentional, and was required, as the call to NewTableDesc in IMPORT doesn't have the necessary infrastructure setup (namely, a valid transaction and the EvalContext Codec) to validate the LocalityConfig at that time. That being said, IMPORT does perform a proper validation of the full table descriptor before it's written to disk. Once it was deemed safe to remove the validation from NewTableDesc, the validate had to be added to startExec of createTableNode, as the LocalityConfig is used in there to generate a zone configuration, and we want to ensure that the LocalityConfig is valid before we do that. At this point there are no other calls to NewTableDesc which require validation of the LocalityConfig. Release note: None Release justification: Fixes bug in interaction between existing functionality and new multi-region feature.
- Loading branch information
Showing
7 changed files
with
220 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
pkg/ccl/importccl/testdata/avro/simple-schema-multi-region-regional-by-row.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- noinspection SqlDialectInspectionForFile | ||
|
||
-- noinspection SqlNoDataSourceInspectionForFile | ||
|
||
CREATE TABLE public.simple ( | ||
i integer PRIMARY KEY, | ||
s text, | ||
b bytea | ||
) LOCALITY REGIONAL BY ROW; | ||
|
10 changes: 10 additions & 0 deletions
10
pkg/ccl/importccl/testdata/avro/simple-schema-multi-region.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- noinspection SqlDialectInspectionForFile | ||
|
||
-- noinspection SqlNoDataSourceInspectionForFile | ||
|
||
CREATE TABLE public.simple ( | ||
i integer PRIMARY KEY, | ||
s text, | ||
b bytea | ||
) LOCALITY REGIONAL BY TABLE; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters