diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-19 18:16:47 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-06 16:20:36 +0300 |
commit | 91b752dce63147bc99d7784d3d37865efb5e9352 (patch) | |
tree | 447dcd9dc5efcb14af5439f247d87938daf845dc /doc | |
parent | 5f742eb95a0080343167469ccabfeccd3630007d (diff) |
Respond to DB health in background migrations
This changes the BackgroundMigration worker so it checks for the health
of the DB before performing a background migration. This in turn allows
us to reduce the minimum interval, without having to worry about blowing
things up if we schedule too many migrations.
In this setup, the BackgroundMigration worker will reschedule jobs as
long as the database is considered to be in an unhealthy state. Once the
database has recovered, the migration can be performed.
To determine if the database is in a healthy state, we look at the
replication lag of any replication slots defined on the primary. If the
lag is deemed to great (100 MB by default) for too many slots, the
migration is rescheduled for a later point in time.
The health checking code is hidden behind a feature flag, allowing us to
disable it if necessary.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/development/background_migrations.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md index 16195cbbbdf..f0d5af9fcb5 100644 --- a/doc/development/background_migrations.md +++ b/doc/development/background_migrations.md @@ -5,6 +5,9 @@ otherwise take a very long time (hours, days, years, etc) to complete. For example, you can use background migrations to migrate data so that instead of storing data in a single JSON column the data is stored in a separate table. +If the database cluster is considered to be in an unhealthy state, background +migrations automatically reschedule themselves for a later point in time. + ## When To Use Background Migrations >**Note:** |