You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ Defines a continuously-refreshed replica of a PostgreSQL database restored from
102
102
| `readOnly` | `bool` | No | `true` | Set the restored database to read-only mode. |
103
103
| `postgresExtraConfig` | `string` | No | — | Extra lines appended to `postgresql.conf` (e.g. `shared_preload_libraries`). |
104
104
| `notifications` | `[]NotificationConfig` | No | `[]` | Notification targets called on restore events. |
105
-
| `persistentSchemas` | `[]string` | No | — | List of schema names to migrate from the previous restore to the new restore on each switchover. |
105
+
| `persistentSchemas` | `[]string` | No | — | List of schema names to migrate from the previous restore to the new restore on each switchover. See [Persistent schemas](#persistent-schemas) below for the migration time budget and what happens on timeout. |
106
106
107
107
The cron expression is parsed using the [cronexpr](https://docs.rs/cronexpr) crate.
108
108
It has two interesting features:
@@ -114,6 +114,24 @@ The jitter is a random duration between -time/2 and +time/2.
114
114
For example, `10m` will result in a jitter between -5m and 5m.
115
115
When using `H` in the cron expression, you might want to set the jitter to zero to properly take advantage of the spread-but-stable behaviour.
116
116
117
+
#### Persistent schemas
118
+
119
+
Each switchover normally drops the new restore (so it carries only what was in the snapshot) and is fast.
120
+
The `persistentSchemas` field opts a schema (e.g. `dbt`) into being **carried across restores** via a `pg_dump | psql` migration Job that runs between the previous restore and the new one.
121
+
A healthy migration takes seconds.
122
+
123
+
The migration has a **hard time budget of 20% of the cron interval** (e.g. ~72 min on a 6-hourly schedule, ~5 h on a daily one).
124
+
If the budget is exceeded — most realistically because some external upstream condition wedges postgres mid-migration — the operator:
125
+
126
+
1. Cancels the migration Job.
127
+
2. Runs `DROP SCHEMA <name> CASCADE` for each persistent schema on the new restore.
128
+
3. Records a `SchemaMigrationTimedOut` Warning event on the replica.
The intent is that **a usable replica beats carrying the schema through**.
133
+
The next restore cycle will re-attempt the migration if the schemas have been regenerated on the source in the meantime; until then the replica is up and serving the snapshot contents.
134
+
117
135
#### SnapshotFilter
118
136
119
137
| Field | Type | Required | Description |
@@ -163,7 +181,7 @@ Additional fields for `target: graphQL`:
163
181
| `notifications` | `[]NotificationStatus` | Status of each configured notification target. |
164
182
| `conditions` | `[]Condition` | Standard Kubernetes conditions. |
165
183
| `schemaMigrationJob` | `string` | Name of the active schema migration Job (set while migration is in progress). |
166
-
| `schemaMigrationPhase` | `string` | Phase of the schema migration (`active`, `complete`, or `failed: <reason>`). |
184
+
| `schemaMigrationPhase` | `string` | Phase of the schema migration (`active`, `complete`, `partial`, `timeout-skipped`, or `failed: <reason>`). See [Persistent schemas](#persistent-schemas). |
167
185
| `persistentSchemaDataSize` | `Quantity` | Measured size of persistent schema data from the last successful migration. Used to size the next restore PVC. |
168
186
| `consecutiveRestoreFailures` | `uint32` | Number of consecutive restore failures. Reset to 0 on success. After 3 consecutive failures the operator stops scheduling new restores until the counter is reset (automatically on next successful restore, or manually via `kubectl patch --subresource=status`). |
0 commit comments