Skip to content

Commit 46aff67

Browse files
authored
Update MySQL switchover tests and docs to enable replica binlog before switchover (#15252)
1 parent dbb997f commit 46aff67

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go.tmpl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4716,6 +4716,9 @@ resource "google_sql_database_instance" "original-replica" {
47164716
settings {
47174717
tier = "db-perf-optimized-N-2"
47184718
edition = "ENTERPRISE_PLUS"
4719+
backup_configuration {
4720+
binary_log_enabled = true
4721+
}
47194722
}
47204723
}
47214724
`, project, primaryName, project, replicaName)
@@ -4762,6 +4765,9 @@ resource "google_sql_database_instance" "original-replica" {
47624765
settings {
47634766
tier = "db-perf-optimized-N-2"
47644767
edition = "ENTERPRISE_PLUS"
4768+
backup_configuration {
4769+
binary_log_enabled = true
4770+
}
47654771
}
47664772
}
47674773
`, project, primaryName, drReplicaName, project, replicaName, primaryName)
@@ -4803,6 +4809,9 @@ resource "google_sql_database_instance" "original-replica" {
48034809
settings {
48044810
tier = "db-perf-optimized-N-2"
48054811
edition = "ENTERPRISE_PLUS"
4812+
backup_configuration {
4813+
binary_log_enabled = true
4814+
}
48064815
}
48074816
}
48084817
`, project, primaryName, project, replicaName, primaryName)

mmv1/third_party/terraform/website/docs/guides/sql_instance_switchover.html.markdown

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ resource "google_sql_database_instance" "original-primary" {
8787

8888
## MySQL
8989

90-
1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and binary log enabled.
90+
1. Create a **cross-region, Enterprise Plus edition** primary and replica. The primary should have backup and binary log enabled, and the replica should have binary log enabled.
9191

9292
```
9393
resource "google_sql_database_instance" "original-primary" {
@@ -126,6 +126,9 @@ resource "google_sql_database_instance" "original-replica" {
126126
# Any tier that supports Enterprise Plus edition.
127127
tier = "db-perf-optimized-N-2"
128128
edition = "ENTERPRISE_PLUS"
129+
backup_configuration {
130+
binary_log_enabled = true
131+
}
129132
}
130133
131134
# You can add more settings.
@@ -168,6 +171,9 @@ resource "google_sql_database_instance" "original-replica" {
168171
settings {
169172
tier = "db-perf-optimized-N-2"
170173
edition = "ENTERPRISE_PLUS"
174+
backup_configuration {
175+
binary_log_enabled = true
176+
}
171177
}
172178
}
173179
```
@@ -177,7 +183,7 @@ resource "google_sql_database_instance" "original-replica" {
177183
* Change `instance_type` from `READ_REPLICA_INSTANCE` to `CLOUD_SQL_INSTANCE`.
178184
* Remove `master_instance_name`.
179185
* Add original primary's name to the original replica's `replica_names` list and `replication_cluster.failover_dr_replica_name`.
180-
* Enable backup and binary log for original replica.
186+
* Enable backup for original replica.
181187

182188
```diff
183189
resource "google_sql_database_instance" "original-primary" {
@@ -218,10 +224,10 @@ resource "google_sql_database_instance" "original-replica" {
218224
settings {
219225
tier = "db-perf-optimized-N-2"
220226
edition = "ENTERPRISE_PLUS"
221-
+ backup_configuration {
227+
backup_configuration {
222228
+ enabled = true
223-
+ binary_log_enabled = true
224-
+ }
229+
binary_log_enabled = true
230+
}
225231
}
226232
}
227233
```

0 commit comments

Comments
 (0)