Database locked in postgresdb

book

Article ID: 126722

calendar_today

Updated On:

Products

CA API Developer Portal CA API Gateway

Issue/Introduction

See the following messages in portal_portal-enterprise container logs 

: Waiting for changelog lock....
[email protected]hostname| 2019-02-12 06:31:51.094 INFO 1 --- [ main] liquibase : Waiting for changelog lock....
[email protected]ostname | 2019-02-12 06:32:01.099 INFO 1 --- [ main] liquibase : Waiting for changelog lock....

Cause

On in-proper power-down and restore the database log lock status can be in set in an unavailable state.  

 

Environment

API Portal 4.2.x
Default Postgres database

Resolution

Connected to the docker container which is not starting.

docker exec -it <containerid> sh

/ # psql -U admin
Password for user admin:
psql (9.6.10)
Type "help" for help.

admin=# \c rbac
You are now connected to database "rbac" as user "admin".
rbac=# SELECT * FROM DATABASECHANGELOGLOCK;

Check for lock record with the Portal container IP.

Run this command to release the lock
UPDATE DATABASECHANGELOGLOCK SET locked='false', lockgranted=null, lockedby=null WHERE id=1;
 

Additional Information

All databases should be checked for LOGLOCK entries. The above example is for rbac database.
Once logged on to psql, run \l command to list all available databases.