forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ccl: add 23.2 version gate to regionless restore
This patch adds a >= 23.2 version gate to the `remove_regions` RESTORE option, in addition to a mixed-version test to ensure that RESTORE fails fast if it is on a cluster version < 23.32. Epic: none Fixes: cockroachdb#111348 Part of: https://cockroachlabs.atlassian.net/browse/CRDB-29129 Release note (sql change): Clusters with versions < 23.2 are not able to use the RESTORE option `remove_regions` (this feature has been version gated).
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 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
59 changes: 59 additions & 0 deletions
59
pkg/ccl/backupccl/testdata/backup-restore/restore-regionless-mixed-version
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,59 @@ | ||
new-cluster name=s1 beforeVersion=23_2_Start disable-tenant localities=us-east-1,us-west-1,eu-central-1 | ||
---- | ||
|
||
exec-sql | ||
CREATE DATABASE d PRIMARY REGION "us-east-1" REGIONS "us-west-1", "eu-central-1"; | ||
CREATE TABLE d.t (x INT); | ||
INSERT INTO d.t VALUES (1), (2), (3); | ||
---- | ||
|
||
query-sql | ||
SELECT region FROM [SHOW REGIONS FROM DATABASE d] ORDER BY 1; | ||
---- | ||
eu-central-1 | ||
us-east-1 | ||
us-west-1 | ||
|
||
query-sql | ||
SHOW DATABASES; | ||
---- | ||
d root us-east-1 {eu-central-1,us-east-1,us-west-1} zone | ||
data root <nil> <nil> {} <nil> | ||
defaultdb root <nil> <nil> {} <nil> | ||
postgres root <nil> <nil> {} <nil> | ||
system node <nil> <nil> {} <nil> | ||
|
||
# backup a cluster | ||
exec-sql | ||
BACKUP INTO 'nodelocal://1/cluster_backup/'; | ||
---- | ||
|
||
new-cluster name=s2 beforeVersion=23_2_Start share-io-dir=s1 disable-tenant | ||
---- | ||
|
||
# restore fails when cluster is in mixed version state while upgrading to 23.2 | ||
exec-sql | ||
RESTORE FROM LATEST IN 'nodelocal://1/cluster_backup/' WITH remove_regions; | ||
---- | ||
pq: to set the remove_regions option, cluster version must be >= 1000023.1-26 | ||
|
||
# upgrade cluster | ||
upgrade-cluster version=23_2 | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE d FROM LATEST IN 'nodelocal://1/cluster_backup/' WITH remove_regions; | ||
---- | ||
|
||
exec-sql | ||
INSERT INTO d.t VALUES (4), (5); | ||
---- | ||
|
||
query-sql | ||
SELECT * FROM d.t | ||
---- | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 |