Open vdelendik opened 3 years ago
If we could add the ability to see the logs of the service that is actually locking the database to be able to know when the process really is done. That way we would be able to know when to delete the lock if the process did not unlock it by itself.
unlock db forcibly using native postgres advisory locks service. in this case after stop we focibly unclock db for the next attempt.
we have potential use-case when DB is locked during upgrade/restart/termination etc. Appropriate steps should be published in documention howto solve the problem:
// login into the container and remove lock: docker exec -ti postgres bash psql -d postgres -U postgres -c "delete from zafira.databasechangeloglock" and restart everything
exception in reporting logs:
2020-10-28 06:30:28.034 INFO [zafira] [main] liquibase.executor.jvm.JdbcExecutor: SELECT LOCKED FROM zafira.databasechangeloglock WHERE ID=1 2020-10-28 06:30:28.035 INFO [zafira] [main] l.lockservice.StandardLockService: Waiting for changelog lock.... 2020-10-28 06:30:38.036 INFO [zafira] [main] liquibase.executor.jvm.JdbcExecutor: SELECT LOCKED FROM zafira.databasechangeloglock WHERE ID=1 2020-10-28 06:30:38.040 INFO [zafira] [main] l.lockservice.StandardLockService: Waiting for changelog lock.... 2020-10-28 06:30:48.040 INFO [zafira] [main] liquibase.executor.jvm.JdbcExecutor: SELECT LOCKED FROM zafira.databasechangeloglock WHERE ID=1 2020-10-28 06:30:48.042 INFO [zafira] [main] l.lockservice.StandardLockService: Waiting for changelog lock.... 2020-10-28 06:30:58.044 INFO [zafira] [main] liquibase.executor.jvm.JdbcExecutor: SELECT ID,LOCKED,LOCKGRANTED,LOCKEDBY FROM zafira.databasechangeloglock WHERE ID=1 2020-10-28 06:30:58.068 ERROR [zafira] [main] c.q.z.d.state.DatabaseStateManager: Could not acquire change log lock. Currently locked by 114e7a89206c (172.18.0.11) since 9/4/20, 12:03 PM liquibase.exception.LockException: Could not acquire change log lock. Currently locked by 114e7a89206c (172.18.0.11) since 9/4/20, 12:03 PM at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:236) at liquibase.Liquibase.update(Liquibase.java:184)