Upgrade Fails Due to a Violation on CONTENT

お困りですか?

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

コミュニティに質問

症状

Upgrade of Confluence fails.

atlassian-confluence.log に次のメッセージが表示される。

2014-02-11 11:03:18,783 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Unsuccessful: alter table CONTENT add constraint FKxxxxxxxxxxx foreign key (PARENTID) references CONTENT (CONTENTID)
2014-02-11 11:03:18,834 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Cannot add or update a child row: a foreign key constraint fails (`confluence`.`#sql-3ecf_52`, CONSTRAINT `FKxxxxxxxxxxx` FOREIGN KEY (`PARENTID`) REFERENCES `CONTENT` (`CONTENTID`))
2014-02-11 11:03:18,841 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema update
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`confluence`.`#sql-3ecf_52`, CONSTRAINT `FKxxxxxxxxxxx` FOREIGN KEY (`PARENTID`) REFERENCES `CONTENT` (`CONTENTID`))
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381) 
2014-02-11 11:03:18,977 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: com.atlassian.config.ConfigurationException: Cannot update schema
com.atlassian.confluence.upgrade.UpgradeException: com.atlassian.config.ConfigurationException: Cannot update schema
	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:111)
..
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`confluence`.`#sql-3ecf_52`, CONSTRAINT `FK6382C05974B18345` FOREIGN KEY (`PARENTID`) REFERENCES `CONTENT` (`CONTENTID`))
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

診断

Please run the query below against your database:

select * from CONTENT where PARENTID not in (select CONTENTID from CONTENT);
tip/resting Created with Sketch.

If the query above returns an empty set, you do not have to follow the steps provided in the resolution as you are not affected by the foreign key violation in Content table. If the query returns a row or more results, please proceed to the resolution. Please take note of the CONTENTIDs of the pages returned in the result.

原因

There are pages in your Confluence that their parent page does not really exist in Confluence.

ソリューション

  • Prepare a full backup of your Confluence database for any potential rollback
  • Run the query below against your database to set the 

  • Please replace <contentID> with the contentIDs from the previous query in Diagnosis.

    update CONTENT set PARENTID=NULL where CONTENTID=<contentID>; 
  • Make sure that there is no more Violations in your database by running the query from the Diagnosis, and then you can proceed with the upgrade again.

最終更新日 2018 年 11 月 12 日

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

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