Two processes running Liquibase against the same Db

I have two Tomcat instances running load balanced agains the same db. Ocassionally, when starting them around the same time I’ll see one hang indefinitely with the error message:

    Waiting for changelog lock....
every 10s. I did some debugging of this and found the LockHandler#acquireLock method attempting to query the log lock table for the value of the LOCKED column. I saw it coming back as "locked" over and over again even though when I looked in the database the LOCKED column was clearly 0 for the record with ID=1.

What gives?

Are you running version 1.9.x ?  The point of the databasechangeloglock is to to stop errors when you have two databases trying to update the same database at the same time. 

There was an error in later 1.9 builds (don’t know when it was introduced exactly) that broke the logic for it to see the database lock was released.  It is fixed in the upcoming 2.0 release and I’m hoping to get the fix backported to the 1.9 builds, but it’s not in there yet.

Nathan

Yes, we’re running 1.9.4.

What you’re describing is exactly what we’re seeing. The query to check if the database is locked seems to be returning a false positive. I can’t tell if it’s using a cache connection, result set or what.

Is there an issue I can track?

I don’t think there is a bug for it, it was something I saw in 2.0 and thought may be specific to that codebase.  I think it was a problem with reading from the same transaction to check the state of the column. 

Could you open a bug on liquibase.jira.com for the 1.9 branch?

Nathan

Filed: http://liquibase.jira.com/browse/CORE-632. Thanks!