Details
Description
STEPS TO REPRODUCE
- Configure an older XWiki instance (e.g. XWiki 11.10.13 or 13.10.11) with MySQL 8.0.31
- Start the instance and run the DW to install the Standard flavor
- Upgrade the instance to XWiki 14.10.3 (for ex by replacing the WAR with the newer one and configuring it with MySQL DB)
EXPECTED RESULTS
No errors are encountered.
ACTUAL RESULTS
When the instance to be upgraded is started (with the new WAR), the following error is displayed in XWiki console:
2023-01-13 15:42:08,178 [XWiki initialization] WARN o.h.e.j.s.SqlExceptionHelper - SQL Error: 1412, SQLState: HY000 2023-01-13 15:42:08,178 [XWiki initialization] ERROR o.h.e.j.s.SqlExceptionHelper - Table definition has changed, please retry transaction 2023-01-13 15:42:08,184 [XWiki initialization] ERROR c.x.x.XWiki - Failed to initialize mandatory document [XWiki.Notifications.Code.NotificationEmailRendererClass] com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document [xwiki:XWiki.Notifications.Code.NotificationEmailRendererClass()] at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1155) at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:395) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2184) at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2246) at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1459) at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1426) at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1335) at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1272) at com.xpn.xwiki.XWiki.<init>(XWiki.java:1245) at com.xpn.xwiki.internal.XWikiInitializerJob.runInternal(XWikiInitializerJob.java:103) at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:246) at org.xwiki.job.AbstractJob.run(AbstractJob.java:223) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: org.hibernate.exception.GenericJDBCException: could not extract ResultSet at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:67) at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:390) at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:163) at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:104) at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:285) at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4550) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4540) at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:571) at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:539) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:208) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:327) at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:108) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:74) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:118) at org.hibernate.internal.SessionImpl.fireLoadNoChecks(SessionImpl.java:1231) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1220) at org.hibernate.internal.SessionImpl.access$2100(SessionImpl.java:202) at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.doLoad(SessionImpl.java:2848) at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.lambda$load$1(SessionImpl.java:2825) at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.perform(SessionImpl.java:2781) at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2825) at org.hibernate.internal.SessionImpl.get(SessionImpl.java:1019) at org.hibernate.engine.spi.SessionDelegatorBaseImpl.get(SessionDelegatorBaseImpl.java:1000) at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1016) ... 12 common frames omitted Caused by: java.sql.SQLException: Table definition has changed, please retry transaction at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1009) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57) ... 35 common frames omitted
The error was reproduced when upgrading XWiki to multiple versions on MySQL 8.0.31 (with both 8.0.28 and 8.0.31 connector versions), but it doesn't reproduce when configuring XWiki with MySQL 8.0.30 using same both connector versions.
I've reproduced the issue also when upgrading XWiki 11.10.13 to 14.40.3 on Docker (Ubuntu environment) on MySQL 8.0.31.
The error couldn't be reproduced with other databases (tested with PostgreSQL 15, MariaDB 10.6, Oracle 19c and HSQL).
Please find attached the full logs from upgrading XWiki 11.10.3 to 14.10.3 on Tomcat.