Liquibase changelog release lock after certain time

Problem Statement:

As part of CICD Approach multiple applications are deployed at once in a kubernetes cluster as pods . Applicstions update databases using liquibase update.
Sometime one or more applications work on same database with ownership on different tables. Since changelog and changeloglock is common across a database, if one application acquires a lock, other applications waits for lock for time defined in changelog-lock-wait-time-in-minutes . This works fine until the application that acquired lock, releases the lock. Unfortunately due to some other timeouts like k8s probes, restarts the pod based on its timeout., the lock is not released and pod goes away, other applications wait until the lock is manually cleared.

Is there a way that lock can exist only certain period of time, like 15 20 mins from the time it is granted.

I don’t believe such functionality currently exists, but it would be a great suggestion for our Idea board:

1 Like

The better solution is to add SIGTERM check to your pod so that it won’t kill the pod if the Liquibase process is actually running. Something like this might get you started:

_term() {
echo “Caught SIGTERM signal!”

v_children=ps -ef | grep -Ei "java|liquibase" | grep -v grep
while [ -n “$v_children” ]; do
echo “Waiting on child processes to complete”
v_children=ps -ef | grep -Ei "java|liquibase" | grep -v grep
sleep 30

echo “Shutting down gunicorn”
kill -TERM “$child” 2>/dev/null
wait “$child”


We already have something like this in place. But it would be better to have a feature like mentioned