liquibase lock in Postgrease in docker
Caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by 85c1e0340e82 (172.18.0.12) since 6/18/20, 11:36 AM
Caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by 85c1e0340e82 (172.18.0.12) since 6/18/20, 11:36 AM
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:236)
at liquibase.Liquibase.update(Liquibase.java:184)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:366)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:314)
at org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase.afterPropertiesSet(DataSourceClosingSpringLiquibase.java:46)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:118)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.afterPropertiesSet(AsyncSpringLiquibase.java:103)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 16 common frames omitted
After some research:
I found solutions.
Find the details of docker image.
%> docker ps -a --filter "name=docker-compose"
%>. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b5b26f985 postgres:12.3 "docker-entrypoint.s…" 5 hours ago Up 19 minutes 5432/tcp docker-compose
Get into image environment
%> docker exec -it b5b26f985 bash
%>root@b5b26f985:/# ls
root@b5b26f985:/# bin boot dev docker-entrypoint-initdb.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
now connect to PG
root@b5b26f985e9b:/# psql -h localhost -U <username >
<username >=# select * from DATABASECHANGELOGLOCK;
id | locked | lockgranted | lockedby
----+--------+-------------------------+----------------------------
1 | t | 2020-06-18 11:36:08.825 | 85c1e0340e82 (172.18.0.12)
(1 row)
Description of table locked type my change form system to system and DB to DB so so good to check the data type.
<username >=# \d DATABASECHANGELOGLOCK;
Table "public.databasechangeloglock"
Column | Type | Collation | Nullable | Default
-------------+-----------------------------+-----------+----------+---------
id | integer | | not null |
locked | boolean | | not null |
lockgranted | timestamp without time zone | | |
lockedby | character varying(255) | | |
Indexes:
"databasechangeloglock_pkey" PRIMARY KEY, btree (id)
Update query
=# update DATABASECHANGELOGLOCK set LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
UPDATE 1
<username >=# SELECT * FROM DATABASECHANGELOGLOCK;
id | locked | lockgranted | lockedby
----+--------+-------------+----------
1 | f | |
(1 row)
--Try now this should work . Happy coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With