Skip to content

Commit

Permalink
sql: add secondary_region to SHOW REGIONS
Browse files Browse the repository at this point in the history
Release note (sql change): SHOW REGIONS now shows information about
secondary regions.

Release justification: low risk update to new functionality.
  • Loading branch information
rafiss committed Aug 26, 2022
1 parent 4471d8b commit 57ed7f7
Show file tree
Hide file tree
Showing 25 changed files with 476 additions and 381 deletions.
8 changes: 4 additions & 4 deletions pkg/ccl/backupccl/restore_old_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@ func restoreOldVersionClusterTest(exportDir string) func(t *testing.T) {
sqlDB.Exec(t, `RESTORE FROM $1`, localFoo)

sqlDB.CheckQueryResults(t, "SHOW DATABASES", [][]string{
{"data", "root", "NULL", "{}", "NULL"},
{"defaultdb", "root", "NULL", "{}", "NULL"},
{"postgres", "root", "NULL", "{}", "NULL"},
{"system", "node", "NULL", "{}", "NULL"},
{"data", "root", "NULL", "NULL", "{}", "NULL"},
{"defaultdb", "root", "NULL", "NULL", "{}", "NULL"},
{"postgres", "root", "NULL", "NULL", "{}", "NULL"},
{"system", "node", "NULL", "NULL", "{}", "NULL"},
})

sqlDB.CheckQueryResults(t, "SHOW SCHEMAS", [][]string{
Expand Down
40 changes: 20 additions & 20 deletions pkg/ccl/backupccl/testdata/backup-restore/multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ RESTORE DATABASE d FROM LATEST IN 'nodelocal://0/database_backup/';
query-sql
SHOW DATABASES;
----
d root us-east-1 {eu-central-1,us-east-1,us-west-1} zone
data root <nil> {} <nil>
defaultdb root <nil> {} <nil>
postgres root <nil> {} <nil>
system node <nil> {} <nil>
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>

# A new cluster with different localities settings.
new-server name=s3 share-io-dir=s1 allow-implicit-access localities=eu-central-1,eu-north-1
Expand Down Expand Up @@ -117,10 +117,10 @@ HINT: to change the default primary region, use SET CLUSTER SETTING sql.defaults
query-sql
SHOW DATABASES;
----
defaultdb root <nil> {} <nil>
no_region_db root eu-central-1 {eu-central-1} zone
postgres root <nil> {} <nil>
system node <nil> {} <nil>
defaultdb root <nil> <nil> {} <nil>
no_region_db root eu-central-1 {eu-central-1} zone
postgres root <nil> <nil> {} <nil>
system node <nil> <nil> {} <nil>

query-sql
USE no_region_db;
Expand Down Expand Up @@ -162,11 +162,11 @@ HINT: to change the default primary region, use SET CLUSTER SETTING sql.defaults
query-sql
SHOW DATABASES;
----
defaultdb root eu-north-1 {eu-north-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> {} <nil>
defaultdb root eu-north-1 {eu-north-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> <nil> {} <nil>

query-sql
USE no_region_db;
Expand All @@ -182,9 +182,9 @@ RESTORE DATABASE eu_central_db FROM LATEST IN 'nodelocal://1/eu_central_database
query-sql
SHOW DATABASES;
----
defaultdb root eu-north-1 {eu-north-1} zone
eu_central_db root eu-central-1 {eu-central-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> {} <nil>
defaultdb root eu-north-1 {eu-north-1} zone
eu_central_db root eu-central-1 {eu-central-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> <nil> {} <nil>
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ RESTORE DATABASE d FROM LATEST IN 'nodelocal://0/database_backup/' with schema_o
query-sql
SHOW DATABASES;
----
d root us-east-1 {eu-central-1,us-east-1,us-west-1} zone
data root <nil> {} <nil>
defaultdb root <nil> {} <nil>
postgres root <nil> {} <nil>
system node <nil> {} <nil>
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>

# A new cluster with different localities settings.
new-server name=s3 share-io-dir=s1 allow-implicit-access localities=eu-central-1,eu-north-1
Expand Down Expand Up @@ -120,10 +120,10 @@ HINT: to change the default primary region, use SET CLUSTER SETTING sql.defaults
query-sql
SHOW DATABASES;
----
defaultdb root <nil> {} <nil>
no_region_db root eu-central-1 {eu-central-1} zone
postgres root <nil> {} <nil>
system node <nil> {} <nil>
defaultdb root <nil> <nil> {} <nil>
no_region_db root eu-central-1 {eu-central-1} zone
postgres root <nil> <nil> {} <nil>
system node <nil> <nil> {} <nil>

query-sql
USE no_region_db;
Expand Down Expand Up @@ -165,11 +165,11 @@ HINT: to change the default primary region, use SET CLUSTER SETTING sql.defaults
query-sql
SHOW DATABASES;
----
defaultdb root eu-north-1 {eu-north-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> {} <nil>
defaultdb root eu-north-1 {eu-north-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> <nil> {} <nil>

query-sql
USE no_region_db;
Expand All @@ -185,9 +185,9 @@ RESTORE DATABASE eu_central_db FROM LATEST IN 'nodelocal://1/eu_central_database
query-sql
SHOW DATABASES;
----
defaultdb root eu-north-1 {eu-north-1} zone
eu_central_db root eu-central-1 {eu-central-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> {} <nil>
defaultdb root eu-north-1 {eu-north-1} zone
eu_central_db root eu-central-1 {eu-central-1} zone
no_region_db root eu-north-1 {eu-north-1} zone
no_region_db_2 root eu-north-1 {eu-north-1} zone
postgres root eu-north-1 {eu-north-1} zone
system node <nil> <nil> {} <nil>
Loading

0 comments on commit 57ed7f7

Please sign in to comment.