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

Confluence LowerCaseUsernameReferencesUpgradeTask will fail on mixed-case usernames in CONTENT_PERM

XMLWordPrintable

      For various reasons CONTENT_PERM table may contain permission settings for the same content, having different usernames. This is usually caused by having the username changed in an external user directory. This causes no problems during normal operation, only upon XML backup restore or for the newly introduced LowerCaseUsernameReferencesUpgradeTask, that seemingly converts all usernames in the CONTENT_PERM table to lowercase.

      In such scenarios, this will cause the upgrade task to fail on unique constraint violation.

      Steps to reproduce

      1. Synchronize an external user directory with Confluence 5.1.x with uppercase username, make sure to add a restriction on a page
      2. Change the username in the external directory to all lowercase, add the same restriction on the same page again
      3. Upgrade the instance to 5.2.3

      Workaround
      Identify the duplicate row by matching the lowercase values of the unique constraint on the CONTENT_PERM table and delete the record that has the uppercase username/groupname.

      Sample error message in Oracle

      2013-08-22 11:35:14,886 INFO [main] [confluence.upgrade.upgradetask.LoginInfoDuplicateEntryRemovalUpgradeTask] doUpgrade No duplicate logininfo rows found. No action necessary.
      2013-08-22 11:35:15,360 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in LINKS table
      2013-08-22 11:35:16,822 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in TRACKBACKLINKS table
      2013-08-22 11:35:16,830 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in FOLLOW_CONNECTIONS table
      2013-08-22 11:35:16,872 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in LABEL table
      2013-08-22 11:35:16,929 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in SPACES table
      2013-08-22 11:35:16,953 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in NOTIFICATIONS table
      2013-08-22 11:35:17,328 INFO [main] [atlassian.confluence.upgrade.UpgradeTask] doUpgrade Finding rows with mixed case username references in CONTENT_PERM table
      2013-08-22 11:35:17,734 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@5913b1de failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [update CONTENT_PERM set USERNAME = ?, CREATOR = ?, LASTMODIFIER = ? where ID = ?]; ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@5913b1de failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [update CONTENT_PERM set USERNAME = ?, CREATOR = ?, LASTMODIFIER = ? where ID = ?]; ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:268)
      at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:193)
      at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:143)
      at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:50)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      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 [update CONTENT_PERM set USERNAME = ?, CREATOR = ?, LASTMODIFIER = ? where ID = ?]; ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      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.execute(JdbcTemplate.java:619)
      at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:866)
      at com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask.updateRows(LowerCaseUsernameReferencesUpgradeTask.java:85)
      at com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask.doUpgrade(LowerCaseUsernameReferencesUpgradeTask.java:71)
      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 com.sun.proxy.$Proxy20.doUpgrade(Unknown Source)
      at com.atlassian.confluence.upgrade.AbstractUpgradeManager$UpgradeStep$3.execute(AbstractUpgradeManager.java:662)
      at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:244)
      ... 18 more
      Caused by: java.sql.SQLException: ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
      at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)
      at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1008)
      at oracle.jdbc.driver.OraclePreparedStatement.executeForRowsWithTimeout(OraclePreparedStatement.java:9855)
      at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9959)
      at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:213)
      at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:881)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)
      ... 35 more
      2013-08-22 11:35:17,744 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1 errors were encountered during upgrade:
      2013-08-22 11:35:17,759 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: PreparedStatementCallback; SQL [update CONTENT_PERM set USERNAME = ?, CREATOR = ?, LASTMODIFIER = ? where ID = ?]; ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated
      ; nested exception is java.sql.SQLException: ORA-00001: unique constraint (WIKI32.CP_UNIQUE_USER_GROUPS) violated

              kmacleod Kenny MacLeod
              pkoczan Peter Koczan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: