PostgreSQL database issue when database user is changed

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

When the old database user is PostgreSQL default super user postgres and a new database user is created and configured in bitbucket.properties, Bitbucket fails to start with the following issue reported in atlassian-bitbucket.log:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapLiquibase' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
	... 5 common frames omitted
Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:289)
	at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:207)
	at liquibase.Liquibase.update(Liquibase.java:184)
	at liquibase.Liquibase.update(Liquibase.java:179)
	at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:317)
	at liquibase.database.ExtendedSpringLiquibase.afterPropertiesSet(ExtendedSpringLiquibase.java:32)
	... 5 common frames omitted
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:173)
	at liquibase.lockservice.StandardLockService.init(StandardLockService.java:121)
	at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:246)
	... 10 common frames omitted
Caused by: liquibase.exception.DatabaseException: Error executing SQL SELECT COUNT(*) FROM public.databasechangeloglock: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:70)
	at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:138)
	at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:146)
	at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:154)
	at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:169)
	at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:190)
	at liquibase.executor.jvm.JdbcExecutor.queryForInt(JdbcExecutor.java:185)
	at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:162)
	... 12 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224)
	at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
	at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
	at liquibase.executor.jvm.JdbcExecutor$QueryStatementCallback.doInStatement(JdbcExecutor.java:419)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
	... 19 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "databasechangeloglock" already exists
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
	at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95)
	at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:109)
	at liquibase.lockservice.StandardLockService.init(StandardLockService.java:97)
	... 11 common frames omitted

診断

環境

  • PostgreSQL 9.5.19

  • Bitbucket Server 6.6.1

原因

There is most likely a database permission issue happening, even though this is not 100% confirmed.

This problem might affect other database tables.

ソリューション

  1. Create a new database and new user according to Connecting Bitbucket Server to PostgreSQL, making sure that this user owns the newly created database
  2. Instead of updating bitbucket.properties directly, use the Database Migration wizard in order to migrate to the newly created database with the newly created user.


説明 PostgreSQL database issue when database user is changed
製品Bitbucket Server
最終更新日: 2019 年 10 月 7 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.