I seem to run into problems with HSQLDB where liquibase gets stuck at “Waiting for lock…” I haven’t attempted to debug it, but being that I’m running HSQLDB as an in memory database, there obviously shouldn’t be an contention on the change lock.
How is the lock released? If I kill liquibase while its in the middle of doing something, will it leave the lock in place? The problem I have is that in my development setup I’m running liquibase each time my application starts up. So liquibase always runs on startup even if there is no migration that is need. So its likely I may kill the application while liquibase is in the middle of doing something (really nothing).
Liquibase runs “update databasechangeloglock set locked=1” when it first starts and “update databasechangeloglock set locked=0” after it has applied any unrun changeSets. If you kill you application while liquibase is checking for changeSets you can be left in a situation where locked doesn’t get set back to 0 and it will keep waiting for the lock indefinitely. We have to commit the transaction after setting locked=1 because each of the changeSets runs in a transaction and when java is killed there is no way for us to recover locked back to 0.
There is a “releaseLocks” command you can use to get yourself out of a locked state. Or you can just set locked=0 yourself however you want.
It would be, although how well that works depends on the database. I used the current implementation because it is the most portable, although it can be overridden with database-specific implementations down the road.