@@ -11,7 +11,7 @@ set-cluster-setting setting=sql.multiregion.system_database_multiregion.enabled
11
11
12
12
exec-sql
13
13
ALTER DATABASE system SET PRIMARY REGION "us-east-1";
14
- CREATE DATABASE d PRIMARY REGION "us-east-1" REGIONS "us-west-1", "eu-central-1" SURVIVE REGION FAILURE;
14
+ CREATE DATABASE d PRIMARY REGION "us-east-1" REGIONS "us-west-1", "eu-central-1" SURVIVE REGION FAILURE SECONDARY REGION "us-west-1" ;
15
15
CREATE TABLE d.t (x INT);
16
16
INSERT INTO d.t VALUES (1), (2), (3);
17
17
----
@@ -23,6 +23,19 @@ eu-central-1
23
23
us-east-1
24
24
us-west-1
25
25
26
+ query-sql
27
+ SHOW ZONE CONFIGURATION FROM DATABASE d;
28
+ ----
29
+ DATABASE d ALTER DATABASE d CONFIGURE ZONE USING
30
+ range_min_bytes = 134217728,
31
+ range_max_bytes = 536870912,
32
+ gc.ttlseconds = 14400,
33
+ num_replicas = 5,
34
+ num_voters = 5,
35
+ constraints = '{+region=eu-central-1: 1, +region=us-east-1: 1, +region=us-west-1: 1}',
36
+ voter_constraints = '{+region=us-east-1: 2, +region=us-west-1: 2}',
37
+ lease_preferences = '[[+region=us-east-1], [+region=us-west-1]]'
38
+
26
39
exec-sql
27
40
BACKUP DATABASE d INTO 'nodelocal://1/database_backup/';
28
41
----
@@ -50,12 +63,25 @@ RESTORE DATABASE d FROM LATEST IN 'nodelocal://1/database_backup/';
50
63
query-sql
51
64
SHOW DATABASES;
52
65
----
53
- d root us-east-1 {eu-central-1,us-east-1,us-west-1} region
66
+ d root us-east-1 us-west-1 {eu-central-1,us-east-1,us-west-1} region
54
67
data root <nil> <nil> {} <nil>
55
68
defaultdb root <nil> <nil> {} <nil>
56
69
postgres root <nil> <nil> {} <nil>
57
70
system node <nil> <nil> {} <nil>
58
71
72
+ query-sql
73
+ SHOW ZONE CONFIGURATION FROM DATABASE d;
74
+ ----
75
+ DATABASE d ALTER DATABASE d CONFIGURE ZONE USING
76
+ range_min_bytes = 134217728,
77
+ range_max_bytes = 536870912,
78
+ gc.ttlseconds = 14400,
79
+ num_replicas = 5,
80
+ num_voters = 5,
81
+ constraints = '{+region=eu-central-1: 1, +region=us-east-1: 1, +region=us-west-1: 1}',
82
+ voter_constraints = '{+region=us-east-1: 2, +region=us-west-1: 2}',
83
+ lease_preferences = '[[+region=us-east-1], [+region=us-west-1]]'
84
+
59
85
# A new cluster with different localities settings.
60
86
new-cluster name=s3 share-io-dir=s1 allow-implicit-access disable-tenant localities=eu-central-1,eu-north-1
61
87
----
@@ -85,6 +111,7 @@ SET enable_multiregion_placement_policy='true';
85
111
ALTER DATABASE d SURVIVE ZONE FAILURE;
86
112
ALTER DATABASE d PLACEMENT RESTRICTED;
87
113
ALTER DATABASE d SET PRIMARY REGION 'eu-central-1';
114
+ ALTER DATABASE d DROP SECONDARY REGION;
88
115
ALTER DATABASE d DROP REGION 'us-east-1';
89
116
ALTER DATABASE d DROP REGION 'us-west-1';
90
117
ALTER DATABASE d ADD REGION 'eu-north-1';
@@ -104,6 +131,7 @@ SET enable_multiregion_placement_policy='true';
104
131
ALTER DATABASE d_new SURVIVE ZONE FAILURE;
105
132
ALTER DATABASE d PLACEMENT RESTRICTED;
106
133
ALTER DATABASE d_new SET PRIMARY REGION 'eu-central-1';
134
+ ALTER DATABASE d_new DROP SECONDARY REGION;
107
135
ALTER DATABASE d_new DROP REGION 'us-east-1';
108
136
ALTER DATABASE d_new DROP REGION 'us-west-1';
109
137
ALTER DATABASE d_new ADD REGION 'eu-north-1';
0 commit comments