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

AddUniqueAttachmentIdConstraintToAttachmentDataUpgradeTask throws ORA-01408 when upgrading Confluence 4.1.x to a higher version with Oracle

XMLWordPrintable

      Only affecting users with Oracle DB
      When upgrading Confluence 4.1.x to 4.1.x (e.g. 4.1.0 to 4.1.5). AddUniqueAttachmentIdConstraintToAttachmentDataUpgradeTask (CONF-7882) tries to create index attch_data_idx on ATTACHMENTDATA (ATTACHMENTID). The upgrade would immediately fail with:

      2012-02-15 00:13:09,789 INFO [main] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 4.1.5 (build #3143)
      2012-02-15 00:13:13,105 INFO [main] [springframework.web.context.ContextLoader] initWebApplicationContext Root WebApplicationContext: initialization started
      2012-02-15 00:13:16,840 INFO [main] [com.atlassian.confluence.lifecycle] <init> Loading EhCache cache manager
      2012-02-15 00:13:35,159 INFO [main] [springframework.web.context.ContextLoader] initWebApplicationContext Root WebApplicationContext: initialization completed in 22054 ms
      2012-02-15 00:13:35,230 DEBUG [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized UpgradeLauncherServletContextListener contextInitialized called
      2012-02-15 00:14:08,715 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Unsuccessful: create index attch_data_idx on ATTACHMENTDATA (ATTACHMENTID)
      2012-02-15 00:14:08,721 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute ORA-01408: such column list already indexed
      
      2012-02-15 00:14:08,723 ERROR [main] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema update
      java.sql.SQLException: ORA-01408: such column list already indexed
      
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
      	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
      	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
      	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
      	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
      	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
      	at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)
      	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
      	at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1822)
      	at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1787)
      	at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:280)
      	at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)
      	at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:167)
      	at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:161)
      	at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:134)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:93)
      	at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:45)
      	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(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:289)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      2012-02-15 00:14:08,772 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:113)
      	at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:45)
      	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(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.inATTACHMENTDATA (ATTACHMENTIDvoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      Caused by: com.atlassian.config.ConfigurationException: Cannot update schema
      	at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:165)
      	at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:134)
      	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:93)
      	... 16 more
      Caused by: java.sql.SQLException: ORA-01408: such column list already indexed
      
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
      	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
      	at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
      	at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
      	at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
      	at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
      	at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
      	at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)
      	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
      	at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1822)
      	at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1787)
      	at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:280)
      	at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)
      	at net.sf.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:167)
      	at bucket.core.persistence.hibernate.schema.SchemaHelper.updateSchemaIfNeeded(SchemaHelper.java:161)
      	... 18 more
      2012-02-15 00:14:08,779 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1 errors were encountered during upgrade:
      2012-02-15 00:14:08,780 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: Cannot update schema
      2012-02-15 00:14:08,780 DEBUG [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized UpgradeLauncherServletContextListener contextInitialized completed successfully
      2012-02-15 00:14:08,781 WARN [main] [atlassian.confluence.plugin.PluginFrameworkContextListener] contextInitialized Not starting full plugin system due to upgrade or licensing errors
      2012-02-15 00:14:09,757 INFO [main] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve
      

      The error is straight forward. Confluence 4.1.x (Oracle) already has an index ATTCH_IDVER_IDX on ATTACHMENTDATA (ATTACHMENTID, ATTVERSION).

      IMHO, Confluence should drop it first or just skip creating it.

      This is related to CONF-15228. But I think this is different because ATTCH_IDVER_IDX was created by Confluence.

      Workaround
      1. Append the following to your Confluence you're upgrading to system properties:
        -Dhibernate.hbm2ddl.skip_creating_missing_indexes=true
        

        This would skip automatic index creation during the upgrade.

      2. Re-run Confluence to trigger the upgrade.

              Unassigned Unassigned
              halatas HuseinA
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: