How does Flyway deal with the fact that several dy

2019-05-31 01:48发布

I am just wondering how Flyway deals with the fact that several dynos can try to run a database migration several times in a clustered environment such as Heroku thereby causing a conflict?

标签: heroku flyway
2条回答
甜甜的少女心
2楼-- · 2019-05-31 01:59

This question explains a bit more how the locking behaviour works. It appears to acquire a lock on the Flyway schema table: select * from dbschema.schema_version for update which might cause problems for longer running migrations as the innodb_lock_wait_timeout setting might cause a timeout, at least in the case of MySQL.

查看更多
戒情不戒烟
3楼-- · 2019-05-31 02:08

It seems Flyway uses locking in order to deal with this issue.

To quote the documentation:

Can multiple nodes migrate in parallel? Yes! Flyway uses the locking technology of your database to coordinate multiple nodes. This ensures that even if even multiple instances of your application attempt to migrate the database at the same time, it still works. Cluster configurations are fully supported.

查看更多
登录 后发表回答