Online DB migration

Hello,

We have witnessed rather long DB migration when going from one Hydra release to another. During that time the hydra_oauth2_access table was locked and the clients experienced the timeouts. The team had to give up on that migration, in fact, and perform it manually on the side (e.g. restoring DB from the snapshot, applying the migration, resyncing the clients and then swapping the migrated DB for the production one). I am wondering if there is a good method for Hydra to perform an online DB migration? I understand that it is grey zone between who is responsible for what, of course. DB maintenance is the owner’s problem but it is Hydra that executes the migration. I am wondering if Hydra could offer an option, for example, to export the DB migration script instead of applying it. Or have support for online migration where possible? Or maybe support the online migration as an option with a tool like https://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html ?

1 Like

Online migrations are database specific (MySQL behaves differently than PostgreSQL behaves differently than CockroachDB …) and sometimes even version specific (PostgreSQL 8 works differently from 9) so it’s insanely hard to implement this in an open source project. Do you know any open source projects that do this?

Could you elaborate?