Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-17182

Upgrade task fails with FK violation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Low
    • None
    • 3.1-m6
    • None

    Description

      Foreign Key violation on upgrade from 3.0 to trunk. See

      https://bamboo.extranet.atlassian.com/browse/PERFENG-PERFTOMCAT6PGSQL16-783/artifact/Output-Logs/target/output.log

      2009-10-10 22:40:35,047 INFO [main] [springframework.web.context.ContextLoader] initWebApplicationContext Root WebApplicationContext: initialization completed in 14720 ms
      create table IMAGEDETAILS (ATTACHMENTID int8 not null, HEIGHT int4, WIDTH int4, MIMETYPE varchar(30), primary key (ATTACHMENTID))
      alter table IMAGEDETAILS add constraint FKA768048734A4917E foreign key (ATTACHMENTID) references ATTACHMENTS
      2009-10-10 22:40:36,155 INFO [main] [atlassian.confluence.upgrade.AbstractUpgradeManager] upgradeStarted Starting automatic upgrade of Confluence
      2009-10-10 22:40:36,495 ERROR [main] [atlassian.confluence.upgrade.AbstractUpgradeManager] doUpgrade Upgrade failed: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:332)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:324)
      	at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:1006)
      	at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:369)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:343)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
      	at com.atlassian.confluence.upgrade.upgradetask.RemoveDuplicatePersonalInformationUpgradeTask$1.doInTransactionWithoutResult(RemoveDuplicatePersonalInformationUpgradeTask.java:48)
      	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
      	at com.atlassian.confluence.upgrade.upgradetask.RemoveDuplicatePersonalInformationUpgradeTask.doUpgrade(RemoveDuplicatePersonalInformationUpgradeTask.java:43)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.doUpgrade(AbstractUpgradeManager.java:115)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:54)
      	at com.atlassian.confluence.upgrade.impl.DefaultUpgradeManager.upgrade(DefaultUpgradeManager.java:71)
      	at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:27)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      2009-10-10 22:40:36,532 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      com.atlassian.confluence.upgrade.UpgradeException: org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.doUpgrade(AbstractUpgradeManager.java:138)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:54)
      	at com.atlassian.confluence.upgrade.impl.DefaultUpgradeManager.upgrade(DefaultUpgradeManager.java:71)
      	at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:27)
      	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:110)
      	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:276)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:354)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
      	at com.atlassian.confluence.upgrade.upgradetask.RemoveDuplicatePersonalInformationUpgradeTask$1.doInTransactionWithoutResult(RemoveDuplicatePersonalInformationUpgradeTask.java:48)
      	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
      	at com.atlassian.confluence.upgrade.upgradetask.RemoveDuplicatePersonalInformationUpgradeTask.doUpgrade(RemoveDuplicatePersonalInformationUpgradeTask.java:43)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.doUpgrade(AbstractUpgradeManager.java:115)
      	... 18 more
      Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:332)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:324)
      	at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:1006)
      	at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:369)
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:343)
      	... 24 more
      2009-10-10 22:40:36,536 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1 errors were encountered during upgrade:
      2009-10-10 22:40:36,536 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: StatementCallback; SQL [DELETE from CONTENT where CONTENTTYPE = 'USERINFO' and (CONTENTID not in (select min(c1.CONTENTID) from CONTENT c1 where c1.CONTENTTYPE = 'USERINFO' group by c1.USERNAME) or USERNAME is null)]; ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fka898d4778dd41734" on table "bodycontent"
        Detail: Key (contentid)=(1420) is still referenced from table "bodycontent".
      
      

      Attachments

        Activity

          People

            dave@atlassian.com dave (Inactive)
            gbarnett George Barnett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: