Issue Details (XML | Word | Printable)

Key: XWIKI-2066
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vincent Massol
Reporter: Vincent Massol
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Migrator fails to upgrade sub wiki databases

Created: 05/Feb/08 12:00   Updated: 06/Feb/08 00:09
Component/s: Storage
Affects Version/s: 1.2.1, 1.3 M1
Fix Version/s: 1.2.2, 1.3 M2

Issue Links:
Related
 

Resolution Date: 06/Feb/08 00:09


 Description  « Hide
This is the problem that you may encounter:
2008-02-05 11:20:21,123 [http://localhost:8081/xwiki/bin/view/Main/] [http-8081-1] INFO  .AbstractXWikiMigrationManager  - Starting migration for database [jguard]... 
2008-02-05 11:20:21,138 [http://localhost:8081/xwiki/bin/view/Main/] [http-8081-1] WARN  util.JDBCExceptionReporter      - SQL Error: 1146, SQLState: 42S02 
2008-02-05 11:20:21,139 [http://localhost:8081/xwiki/bin/view/Main/] [http-8081-1] ERROR util.JDBCExceptionReporter      - Table 'jguard.xwikidbversion' doesn't exist 
2008-02-05 11:20:21,143 [http://localhost:8081/xwiki/bin/view/Main/] [http-8081-1] INFO  .AbstractXWikiMigrationManager  - Failed to migrate database [jguard]... 
com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while hibernate execute
Wrapped Exception: could not execute query
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:922)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:947)
	at com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager.getDBVersion(XWikiHibernateMigrationManager.java:61)
	at com.xpn.xwiki.store.migration.AbstractXWikiMigrationManager.startMigrationsForDatabase(AbstractXWikiMigrationManager.java:167)
	at com.xpn.xwiki.store.migration.AbstractXWikiMigrationManager.startMigrations(AbstractXWikiMigrationManager.java:117)
	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:721)
	at com.xpn.xwiki.XWiki.<init>(XWiki.java:672)
	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:241)
	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:439)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:94)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)


Wrapped Exception:


com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'jguard.xwikidbversion' doesn't exist
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1448)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
	at org.hibernate.loader.Loader.doQuery(Loader.java:662)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
	at org.hibernate.loader.Loader.doList(Loader.java:2145)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
	at org.hibernate.loader.Loader.list(Loader.java:2024)
	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
	at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
	at com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager$1.doInHibernate(XWikiHibernateMigrationManager.java:65)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:918)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:947)
	at com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager.getDBVersion(XWikiHibernateMigrationManager.java:61)
	at com.xpn.xwiki.store.migration.AbstractXWikiMigrationManager.startMigrationsForDatabase(AbstractXWikiMigrationManager.java:167)
	at com.xpn.xwiki.store.migration.AbstractXWikiMigrationManager.startMigrations(AbstractXWikiMigrationManager.java:117)
	at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:721)
	at com.xpn.xwiki.XWiki.<init>(XWiki.java:672)
	at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:241)
	at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:439)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:94)

The problem is that the update schema is done only when calling a URL and thus only the corresponding database has the new schema updated. So for all other dbs the xwikiversion table is not created and thus the migrator fails with a "table doesn't exist" error...



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Vincent Massol added a comment - 05/Feb/08 12:12
The solution is to move the update schema code and the migrator in servlet context listeners.

Vincent Massol added a comment - 05/Feb/08 13:14
Note that the current workaround is to:
  • migrate only the main database to start with
  • then to hit manually each database (using a corresponding view URL)
  • then run the migration on all databases that you've hit

Vincent Massol added a comment - 06/Feb/08 00:09
Fixed