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

ContentPermissionConstraintsUpgradeTask Upgrade to 3.5.x failed due to duplicate permissions

XMLWordPrintable

      ContentPermissionConstraintsUpgradeTask will fail during an upgrade to 3.5.x when there is duplicate permissions. Here is the stacktrace:

      2011-10-03 16:42:06,800 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask@c384f5 failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [DELETE FROM CONTENT_PERM_SET WHERE ID = ?]; Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)) 
      com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask@c384f5 failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [DELETE FROM CONTENT_PERM_SET WHERE ID = ?]; Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)) 
       at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:212) 
       at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:137) 
       at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:94) 
       at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:29) 
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205) 
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704) 
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
       at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) 
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
       at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) 
       at org.apache.catalina.core.StandardService.start(StandardService.java:525) 
       at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) 
       at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
       at java.lang.reflect.Method.invoke(Unknown Source) 
       at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 
      Caused by: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [DELETE FROM CONTENT_PERM_SET WHERE ID = ?]; Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)) 
       at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228) 
       at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) 
       at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607) 
       at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:792) 
       at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:850) 
       at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:854) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsCleaner$2.processRow(ContentPermissionConstraintsCleaner.java:166) 
       at org.springframework.jdbc.core.JdbcTemplate$RowCallbackHandlerResultSetExtractor.extractData(JdbcTemplate.java:1368) 
       at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:448) 
       at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396) 
       at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458) 
       at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:462) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsCleaner.removeDuplicateContentPermissionSetEntries(ContentPermissionConstraintsCleaner.java:177) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsCleaner.cleanUp(ContentPermissionConstraintsCleaner.java:70) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsCleaner$$FastClassByCGLIB$$42f4de60.invoke(<generated>) 
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) 
       at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) 
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) 
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
       at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsCleaner$$EnhancerByCGLIB$$2b62c167.cleanUp(<generated>) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask.doPreUpgradeCleanup(ContentPermissionConstraintsUpgradeTask.java:175) 
       at com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask.doUpgrade(ContentPermissionConstraintsUpgradeTask.java:114) 
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
       at java.lang.reflect.Method.invoke(Unknown Source) 
       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) 
       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) 
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) 
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
       at $Proxy33.doUpgrade(Unknown Source) 
       at com.atlassian.confluence.upgrade.AbstractUpgradeManager$UpgradeStep$3.execute(AbstractUpgradeManager.java:479) 
       at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:188) 
       ... 18 more 
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence40`.`content_perm`, CONSTRAINT `FKBD74B31676E33274` FOREIGN KEY (`CPS_ID`) REFERENCES `content_perm_set` (`ID`)) 
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
       at java.lang.reflect.Constructor.newInstance(Unknown Source) 
       at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) 
       at com.mysql.jdbc.Util.getInstance(Util.java:381) 
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038) 
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563) 
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495) 
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) 
       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113) 
       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2693) 
       at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2102) 
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2395) 
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2313) 
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2298) 
       at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) 
       at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:798) 
       at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591) 
       ... 52 more
      

      Looks like something could be wrong or could've done better on ContentPermissionConstraintsCleaner#removeDuplicateContentPermissionSetEntries.

      Woarkaround

      https://confluence.atlassian.com/x/cFXZDw

              shaffenden Steve Haffenden (Inactive)
              halatas HuseinA
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: