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

Upgrade to 5.2 or above on Oracle fails with "Table 'X' has more than one primary key" if another schema exists containing a shared table name

      Symptoms

      When upgrading, the task fails with a message like:

      2013-10-15 08:05:27,164 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@90580fa failed during the SCHEMA_UPGRADE phase due to: Table 'NOTIFICATIONS' has more than one primary key
      com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@90580fa failed during the SCHEMA_UPGRADE phase due to: Table 'NOTIFICATIONS' has more than one primary key
      

      This is due to the Hibernate bug https://hibernate.atlassian.net/browse/HHH-2208, which is fixed, but Confluence still uses an old version including this bug. Ordinarily, the workaround of creating a schema-local "all_objects" view has prevented issues which have come up, however in this case, that workaround does not work.

      Steps to Reproduce

      1. Install Confluence into multiple schemas in the same Oracle database at a version below 5.2
      2. Attempt to upgrade one of them to 5.2

      Workaround

      Follow the steps in the KB article Upgrade Failed with "Table '<Table Name>' has more than one primary key" Error Message

            [CONFSERVER-31333] Upgrade to 5.2 or above on Oracle fails with "Table 'X' has more than one primary key" if another schema exists containing a shared table name

            Corentin Méhat added a comment - - edited

            Hello,

            I am experiencing the same with a pgsql database during an upgrade of confluence from 4.3.7 to 5.10.3

            //atlassian-confluence.log
            2016-10-13 17:11:24,154 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@10fa3576 failed during the SCHEMA_UPGRADE phase due to: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid]
            com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@10fa3576 failed during the SCHEMA_UPGRADE phase due to: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid]
            	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:229)
            	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:185)
            	at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:138)
            	at com.atlassian.confluence.plugin.PluginFrameworkContextListener.launchUpgrades(PluginFrameworkContextListener.java:118)
            	at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:77)
            	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
            	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
            	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
            	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
            	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
            	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            	at java.lang.Thread.run(Thread.java:745)
            Caused by: java.lang.IllegalStateException: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid]
            	at com.atlassian.confluence.upgrade.upgradetask.DataAccessUtils.lambda$getPrimaryKeyColumnName$1(DataAccessUtils.java:216)
            	at com.atlassian.confluence.upgrade.upgradetask.DataAccessUtils$$Lambda$446/1560874420.apply(Unknown Source)
            [...]
            

            Corentin Méhat added a comment - - edited Hello, I am experiencing the same with a pgsql database during an upgrade of confluence from 4.3.7 to 5.10.3 //atlassian-confluence.log 2016-10-13 17:11:24,154 ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@10fa3576 failed during the SCHEMA_UPGRADE phase due to: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid] com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LowerCaseUsernameReferencesUpgradeTask@10fa3576 failed during the SCHEMA_UPGRADE phase due to: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid] at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:229) at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:185) at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:138) at com.atlassian.confluence.plugin.PluginFrameworkContextListener.launchUpgrades(PluginFrameworkContextListener.java:118) at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:77) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) Caused by: java.lang.IllegalStateException: Table 'SPACEPERMISSIONS' has a multi-column primary key on [permid, permid] at com.atlassian.confluence.upgrade.upgradetask.DataAccessUtils.lambda$getPrimaryKeyColumnName$1(DataAccessUtils.java:216) at com.atlassian.confluence.upgrade.upgradetask.DataAccessUtils$$Lambda$446/1560874420.apply(Unknown Source) [...]

            Hi,

            Could you please confirm whether this bug affects Confluence upgrades only or is also Jira upgrades affected?

            Regards

            Robert

            Robert Dahlborg added a comment - Hi, Could you please confirm whether this bug affects Confluence upgrades only or is also Jira upgrades affected? Regards Robert

              Unassigned Unassigned
              dmason David Mason (Inactive)
              Affected customers:
              1 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: