How does Flyway deal with the fact that several dynos can try to run several migrations in parallel?

孤街浪徒 提交于 2019-12-23 03:38:18

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/30223293/how-does-flyway-deal-with-the-fact-that-several-dynos-can-try-to-run-several-mig

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!