-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent concurrent deploys against a given schema w/ a timeout functionality #111
Comments
I was just about to file a bug on this but I found this issue. This is a showstopper for us. We can't use Obevo with out this support. I recommend perhaps looking at how Flyway does it since they support a global lock for cluster support. Perhaps if I have time next week I will look into forking and making the change. |
Can you elaborate on your use case a bit more (ie how you are using Obevo/Flyway to do deployments) and why this is critical? I'd like to know to ensure that whatever I had in mind originally for this (as listed in the ticket) still satisfies your use case I'll give the implementation a think in the meantime |
See my comments on #242 but basically when an application is deployed into production it will do the migration programmatically. Since we have a cluster of applications that maybe in the process of rebooting for upgrade or canary testing we absolutely need cluster support and to be honest even Flyway doesn't do this correctly. This is because the application needs to tell Flyway/Obevo what the current version being deployed/rebooted is of the instance (the application version and not the schema). This requires another table or something akin that has the version of the application stored. Flyway does not support this see flyway/flyway#1999 . For Flyway we sort of have a forked workaround and we will probably do the same for Obevo (this is because we need access to the connection). If the application initializing is:
|
Thanks for the info In terms of locking the schema for deploy, we should be able to add a hook into our code (see MainDeployer.kt and the I do see a couple other interesting tidbits in your use case:
If the latter, then we have some thoughts on that (see section C here with the addendum/correction here)
|
An update here - I have a POC working locally (code is committed to the "concurrentDeployCheck" branch, but it is a work in progress, a lot of cleanup to do and hacks still in the code). But wanted to talk this through a bit In terms of how it will work:
Before I do further code changes on this, I'll write up the "application version" support that I mentioned in the last post (I will aim for that in the next couple days), so that you can have more info on how to proceed |
@agentgt See this doc for more information on the application deployment use case. Note the existing methodology around rollback. We do have the option to change what is done in case you need something different besides the default rollback behavior (e.g. to instead do nothing instead of attempting a deploy, in case a lower version competitor is found). We can also implement this via semantic versioning if easier Let us know your thoughts |
@agentgt A bit of a delay on our end, but we finally merged this change into master for PostgreSQL Let me know if you have any questions on this |
Note - timeout hasn't been added at this time, and lock is against the DB server itself, vs just an individual schema |
Expected Behavior
Prevent a deploy from being executed if one of the physical schemas requested for deployment is already being deployed to by another process
Allow a timeout to be specified so that we don't have a case where a process exits and doesn't "unlock" the deployment
Ensure that "unlocking" happens on shutdown hook if needed
Try to check on active processes via some approach, whether by checking the PID of the deploy process or the connection number
The above assume a pessimistic lock. Brainstorm if optimistic lock could work? However, DBMS types like Sybase IQ by default will lock a whole table on a write, making optimistic locking difficult in practice
Actual Behavior
No such lock behavior exists
Obevo Version where this issue was observed
All versions lack this feature
Steps to reproduce
Try in an in-memory db?
The text was updated successfully, but these errors were encountered: