Bamboo fails to start after PostgreSQL migration with error relation build does not exist

お困りですか?

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

コミュニティに質問

問題

Bamboo fails to start after migrating PostgreSQL database to another PostgreSQL server with the following steps:

  1. Migrate PostgreSQL server through pg_dump to another server
  2. Configure bamboo.cfg.xml to refer to the new PostgreSQL server

atlassian-bamboo.log に次のメッセージが出力される。

2017-08-24 15:59:22,866 ERROR [localhost-startStop-1] [AbstractUpgradeManager] org.postgresql.util.PSQLException: ERROR: relation "build" does not exist
  Position: 34
org.postgresql.util.PSQLException: ERROR: relation "build" does not exist
  Position: 34
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2310)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2023)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:217)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:421)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:318)
	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:281)
	at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:327)
	at com.atlassian.bamboo.upgrade.tasks.validation.PlanKeysCorrectlyFormatted$1.doInHibernateTransaction(PlanKeysCorrectlyFormatted.java:39)
	at com.atlassian.bamboo.upgrade.AbstractBootstrapUpgradeTask.withDatabaseConnection(AbstractBootstrapUpgradeTask.java:69)

診断

Run the following SQL query to check if there is a search_path configured for the database user:

SELECT r.rolname, d.datname, rs.setconfig
FROM   pg_db_role_setting rs
LEFT   JOIN pg_roles      r ON r.oid = rs.setrole
LEFT   JOIN pg_database   d ON d.oid = rs.setdatabase
WHERE  r.rolname = 'databaseUser' OR d.datname = 'databaseName';

Replace databaseUser and databaseName with the settings in bamboo.cfg.xml

If there is no result, it means that the database user is using the default search_path public

原因

  • PostgreSQL is using the search_path public by default
  • The database dump is migrated to a custom schema and/or the database user is configured with incorrect search_path

ソリューション

Configure the database user to use the correct search_path with the following SQL and restart Bamboo:

ALTER ROLE databaseUser SET search_path TO customSchema;

Replace databaseUser and customSchema with the correct settings

最終更新日 2019 年 9 月 23 日

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

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