Problems upgrading from Confluence 3.5 to 4.3 (standalone, mysql 5.1.61 database)
Asked by Tore Hermansen:

<br />

When I tried upgrading from Confluence 3.5 to 4.3 on our test system the update fails when attempting to update the database.

What steps should I take?

Stacktrace:

2012-09-14 15:12:25,145 INFO main confluence.upgrade.ddl.HibernateAlterTableExecutor alterTable Executing grouped alter table command on LIKES

2012-09-14 15:12:25,146 INFO main confluence.upgrade.ddl.HibernateDdlExecutor executeDdlStatements Executing DDL: alter table LIKES add constraint like_cid_name_uni unique (CONTENTID, USERNAME)

2012-09-14 15:12:25,147 INFO main confluence.upgrade.ddl.HibernateAlterTableExecutor alterTable Executing ungrouped alter table commands on LIKES

2012-09-14 15:12:25,149 INFO main confluence.upgrade.ddl.HibernateDdlExecutor executeDdlStatements Executing DDL: alter table LIKES add constraint like_cid_name_uni unique (CONTENTID, USERNAME)

2012-09-14 15:12:25,150 INFO main confluence.upgrade.ddl.HibernateAlterTableExecutor alterTableUngrouped Database is reporting that the column already has the property that we want. SQL: alter table LIKES add constraint like_cid_name_uni unique (CONTENTID, USERNAME)

2012-09-14 15:12:25,151 INFO main confluence.upgrade.ddl.HibernateDdlExecutor executeDdlStatements Executing DDL: create index like_cid_idx on LIKES (CONTENTID)

2012-09-14 15:12:25,174 ERROR main atlassian.confluence.upgrade.UpgradeLauncherServletContextListener contextInitialized Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LikesSqlConstraintsUpgradeTask@341ad6e5 failed during the UPGRADE phase due to: StatementCallback; bad SQL grammar create index like_cid_idx on LIKES (CONTENTID) ; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'like_cid_idx'

com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.LikesSqlConstraintsUpgradeTask@341ad6e5 failed during the UPGRADE phase due to: StatementCallback; bad SQL grammar create index like_cid_idx on LIKES (CONTENTID) ; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'like_cid_idx'

at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:251)

at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runUpgradeTasks(AbstractUpgradeManager.java:187)

at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:132)

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)

Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar create index like_cid_idx on LIKES (CONTENTID) ; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'like_cid_idx'

at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:429)

at com.atlassian.confluence.upgrade.ddl.HibernateDdlExecutor.executeDdlStatements(HibernateDdlExecutor.java:66)

at com.atlassian.confluence.upgrade.ddl.HibernateDdlExecutor.executeDdl(HibernateDdlExecutor.java:55)

at com.atlassian.confluence.upgrade.upgradetask.LikesSqlConstraintsUpgradeTask.doUpgrade(LikesSqlConstraintsUpgradeTask.java:61)

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.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 $Proxy47.doUpgrade(Unknown Source)

at com.atlassian.confluence.upgrade.AbstractUpgradeManager$UpgradeStep$4.execute(AbstractUpgradeManager.java:531)

at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:227)

... 18 more

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'like_cid_idx'

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

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:1051)

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.ConnectionImpl.execSQL(ConnectionImpl.java:2616)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:782)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:625)

at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)

at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:422)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:396)

... 35 more

2012-09-14 15:12:25,179 ERROR main atlassian.confluence.upgrade.UpgradeLauncherServletContextListener contextInitialized 1 errors were encountered during upgrade:

2012-09-14 15:12:25,179 ERROR main atlassian.confluence.upgrade.UpgradeLauncherServletContextListener contextInitialized 1: StatementCallback; bad SQL grammar create index like_cid_idx on LIKES (CONTENTID) ; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'like_cid_idx'


Answers:
author: Bruna Griebeler
body: Hi Tore

I believe you might be experiecing this issue:

[Upgrade fails due to previously failed upgrade attempt on same instance](https://confluence.atlassian.com/display/CONFKB/Upgrade+fails+due+to+previously+failed+upgrade+attempt+on+same+instance)

Seems like confluence is trying to create tables that are already created.

Check out the resolution on the link above.

Hope it helps!!


Tags: mysql

upgrade