-
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.
backupccl: check mismatched cluster regions on backup and restore
Previously, if a restore cluster mismatched the regions in backup cluster, the data would be restored as if the zone configuration does not exist because we did not do the region check for users. This patch checks the regions used by backup at restore planning phase, and hence users are aware of mismatched regions between backup and restore cluster. If there's a mismatched region, users can either update cluster localities or restore with option `--skip-localities-check` to continue. For serverless users, they are allowed to run restore with `--skip-localities-check` specified. Release note (enterprise change): Previously, if a restore cluster mismatched the regions in backup cluster, the data would be restored as if the zone configuration does not exist. This patch checks the regions before restore and hence users are aware of mismatched regions between backup and restore cluster. If there's a mismatched region, users can either update cluster localities or restore with option `--skip-localities-check` to continue.
- Loading branch information
1 parent
df6ab49
commit 41a08b1
Showing
12 changed files
with
269 additions
and
31 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
new-server name=s1 allow-implicit-access 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]; | ||
---- | ||
eu-central-1 | ||
us-east-1 | ||
us-west-1 | ||
|
||
exec-sql | ||
BACKUP DATABASE d TO 'nodelocal://1/database_backup/'; | ||
---- | ||
|
||
exec-sql | ||
BACKUP TO 'nodelocal://1/full_cluster_backup/'; | ||
---- | ||
|
||
# A new cluster with the same locality settings. | ||
new-server name=s2 share-io-dir=s1 allow-implicit-access localities=us-east-1,us-west-1,eu-central-1 | ||
---- | ||
|
||
exec-sql | ||
RESTORE FROM 'nodelocal://0/full_cluster_backup/'; | ||
---- | ||
|
||
exec-sql | ||
DROP DATABASE d; | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE d FROM 'nodelocal://0/database_backup/'; | ||
---- | ||
|
||
|
||
# A new cluster with different localities settings. | ||
new-server name=s3 share-io-dir=s1 allow-implicit-access localities=us-east-1,eu-central-1,eu-north-1 | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE d FROM 'nodelocal://0/database_backup/'; | ||
---- | ||
pq: detected a mismatch in regions between the restore cluster and the backup cluster, missing regions detected: us-west-1. | ||
|
||
exec-sql | ||
RESTORE FROM 'nodelocal://0/full_cluster_backup/'; | ||
---- | ||
pq: detected a mismatch in regions between the restore cluster and the backup cluster, missing regions detected: us-west-1. |
Oops, something went wrong.