-
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.
sql: repartition regional by row tables on region add
This patch adds functionality to repartition REGIONAL BY ROW tables when a new region is added to the database. An index can only be partitioned using an enum value if it is PUBLIC. Thus we only modify partition descriptors once all transitioning enum members have done so successfully. This happens in the same transaction that promoted the enum members, ensuring sane rollbacks in the face of non-retryable partitioning failure. Once partitioning is complete, zone configurations are applied to partitions as well. This patch changes how uncommitted type descriptors are stored to enable partitioning in the same transaction that previously promoted enum members. A column's types.T is hydrated using enum metadata fields that are cached on the type descriptor. Previously, this cache was constructed based on the cluster version of the type descriptor and not updated when the type descriptor was modified. After this patch, whenever a type descriptor is added back as an uncomitted descriptor to the desc collection, we reconstruct the cached fields stored on it. For us, this means that tables being partitioned are hydrated with the correct visibility for enum members, which allows us to partition on values promoted in the same transaction. Release note (sql change): ALTER DATABASE ... ADD REGION now repartitions REGIONAL BY ROW tables and updates the zone configs on the newly created partitions as well.
- Loading branch information
1 parent
3825fd1
commit 99ee0be
Showing
13 changed files
with
886 additions
and
23 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
506 changes: 506 additions & 0 deletions
506
pkg/ccl/logictestccl/testdata/logic_test/regional_by_row
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Oops, something went wrong.