Upgrade problems (2.9.2 > 3.5.17)
Asked by Ruben Demey:

Hi,

I had a lot of MySQL related problems when trying to perform an upgrade from 2.9.2 to 3.5.17. Managed to resolve most of them using guides from Confluence documentation:

1. I changed transaction isolation as described here:

[https://confluence.atlassian.com/display/CONFKB/Confluence+Does+Not+Start+with+%27MySQL+session+isolation+level+%27REPEATABLE-READ%27+is+no+longer+supported%27+Message](https://confluence.atlassian.com/display/CONFKB/Confluence+Does+Not+Start+with+%2527MySQL+session+isolation+level+%2527REPEATABLE-READ%2527+is+no+longer+supported%2527+Message)

2. Altered DB engine to InnoDb as described here:

<https://confluence.atlassian.com/pages/viewpage.action?pageId=192872609>

3. Changed JDBC connection settings and table character sets and collations as described here:

<https://confluence.atlassian.com/display/DOC/Configuring+Database+Character+Encoding>

4. Modified my.cnf to achieve this:

Server characterset: utf8

Db characterset: utf8

Client characterset: utf8

Conn. characterset: utf8

But now I'm stuck with this one:
> 2012-09-14 11:07:03,694 INFO main com.atlassian.confluence.lifecycle contextInitialized Starting Confluence 3.5.17 (build #2176)
>
> 2012-09-14 11:07:06,523 INFO main atlassian.plugin.manager.DefaultPluginManager init Initialising the plugin system
>
> 2012-09-14 11:07:06,763 INFO main atlassian.plugin.manager.DefaultPluginManager init Plugin system started in 0:00:00.238
>
> 2012-09-14 11:07:08,342 INFO main springframework.web.context.ContextLoader initWebApplicationContext Root WebApplicationContext: initialization started
>
> 2012-09-14 11:07:13,315 INFO main com.atlassian.confluence.lifecycleLoading EhCache cache manager
>
> 2012-09-14 11:07:24,960 ERROR main confluence.search.lucene.ConfluenceSearcherInitialisation initialise Error encountered while warming up searcher - The index has not been upgraded. Please reindex.
>
> 2012-09-14 11:07:40,762 INFO main springframework.web.context.ContextLoader initWebApplicationContext Root WebApplicationContext: initialization completed in 32412 ms
>
> 2012-09-14 11:07:45,233 ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Unsuccessful: alter table external_members add constraint FKD8C8D8A5117D5FDA foreign key (groupid) references groups (id)
>
> 2012-09-14 11:07:45,236 ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute Can't create table 'confluence.#sql-55c4_d' (errno: 121)
>
> 2012-09-14 11:07:45,237 ERROR main hibernate.tool.hbm2ddl.SchemaUpdate execute could not complete schema update
>
> java.sql.SQLException: Can't create table 'confluence.#sql-55c4_d' (errno: 121)
>
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)
>
> 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:2687)
>
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
>
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
>
> 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:91)
>
> at com.atlassian.confluence.upgrade.impl.DefaultUpgradeManager.upgrade(DefaultUpgradeManager.java:140)
>
> at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:28)
>
> 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)
>
> 2012-09-14 11:07:45,281 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:111)
>
> at com.atlassian.confluence.upgrade.impl.DefaultUpgradeManager.upgrade(DefaultUpgradeManager.java:140)
>
> at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:28)
>
> 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: 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:91)
>
> ... 17 more
>
> Caused by: java.sql.SQLException: Can't create table 'confluence.#sql-55c4_d' (errno: 121)
>
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1072)
>
> 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:2687)
>
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
>
> at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
>
> 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)
>
> ... 19 more
>
> 2012-09-14 11:07:45,292 ERROR main atlassian.confluence.upgrade.UpgradeLauncherServletContextListener contextInitialized 1 errors were encountered during upgrade:
>
> 2012-09-14 11:07:45,293 ERROR main atlassian.confluence.upgrade.UpgradeLauncherServletContextListener contextInitialized 1: Cannot update schema
>
> 2012-09-14 11:07:47,766 INFO main com.atlassian.confluence.lifecycle init Confluence is ready to serve
>
SHOW INNODB STATUS says:
> ------------------------
>
> LATEST FOREIGN KEY ERROR
>
> ------------------------
>
> 120914 11:07:45 Error in foreign key constraint creation for table \`confluence\`..
>
> A foreign key constraint of name \`confluence/FKD8C8D8A5117D5FDA\`
>
> already exists. (Note that internally InnoDB adds 'databasename/'
>
> in front of the user-defined constraint name).
>
> Note that InnoDB's FOREIGN KEY system tables store
>
> constraint names as case-insensitive, with the
>
> MySQL standard latin1_swedish_ci collation. If you
>
> create tables or databases whose names differ only in
>
> the character case, then collisions in constraint
>
> names can occur. Workaround: name your constraints
>
> explicitly with unique names.

Any help would be appreciated.

Regards,

Igor


Answers:
author: Ruben Demey
body: So, the answer to my problem was to manualy remove 3 foreign key constrains from the database before performing the upgrade (those 3 the upgrade was complaining about).

After that the upgrade from 2.9.2 to 3.5.17 went fine.


author: AlysonA
body: Hello Igor,

Firstly, can you confirm you're trying to upgrade Confluence from the 2.9.2 straight to 3.5.17? If so, this will likely fail (as you can see already) since it's a pretty big jump and there were a lot of database changes introduced in recent Confluence versions.

I suggest you use an intermediary step before going to 3.5.\*. In this case it would be 2.9.2 \> 3.0 (introduced new license version) \> 3.5.17.

Can you try that out and let us know the results?

comments: author: Ruben Demey
body: Hi Alyson,

I tried to do what you suggested (with version 3.0.2). Unfortunately, the results were very similar: <http://pastie.org/4738194>


Tags: mysql

upgrade