Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-20184

R140401000XWIKI15460 Migration error when migrating from < 14.0 if user belongs to subwiki

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      R140401000XWIKI15460 can lead to a DB migration error when executed on a wiki < 14.0 if there's users belonging to subwiki, apparently because the schema is updated per wiki before executing the migration on same wiki, and the migration is checking presence of users by switching on the wiki of the users: it can lead to an error because the schema migration for adding new fields has not been performed yet.
      Example of such stacktrace:

      2022-10-04 08:56:50,093 [XWiki initialization] ERROR .HibernateDataMigrationManager - Failed to migrate database [xwiki]... 
      com.xpn.xwiki.store.migration.DataMigrationException: Data migration R140401000XWIKI15460 failed
              at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:120)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrations(AbstractDataMigrationManager.java:837)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.migrateDatabase(AbstractDataMigrationManager.java:736)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrations(AbstractDataMigrationManager.java:657)
              at com.xpn.xwiki.store.migration.hibernate.HibernateDataMigrationManager.startMigrations(HibernateDataMigrationManager.java:357)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.startMigrationsOnlyOnce(AbstractDataMigrationManager.java:637)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.tryToProcceedToMigration(AbstractDataMigrationManager.java:614)
              at com.xpn.xwiki.store.migration.AbstractDataMigrationManager.checkDatabase(AbstractDataMigrationManager.java:539)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:704)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.setWiki(HibernateStore.java:663)
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:865)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:576)
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1028)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:395)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2164)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2226)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1439)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1406)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1315)
              at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:1252)
              at com.xpn.xwiki.XWiki.<init>(XWiki.java:1225)
              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:829)
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Failed to identify if the owner of [DefaultNotificationFilterPreference{id='NFP_391', internalId=391, owner='playground:XWiki.dvincent', filterName='scopeNotificationFilter', providerHint='null', enabled=true, active=false, filterType=INCLUSIVE, notificationFormats=[ALERT, EMAIL], startingDate=2020-02-11 17:14:48.0, eventTypes=[], user='null', pageOnly='playground:Blabla.WebHome', page='null', wiki='null'}] exists.
      Caused by: com.xpn.xwiki.store.migration.DataMigrationException: Failed to identify if the owner of [DefaultNotificationFilterPreference{id='NFP_391', internalId=391, owner='playground:XWiki.dvincent', filterName='scopeNotificationFilter', providerHint='null', enabled=true, active=false, filterType=INCLUSIVE, notificationFormats=[ALERT, EMAIL], startingDate=2020-02-11 17:14:48.0, eventTypes=[], user='null', pageOnly='playground:Blabla.WebHome', page='null', wiki='null'}] exists.
              at org.xwiki.notifications.filters.migration.R140401000XWIKI15460DataMigration.identifyRemovedUsers(R140401000XWIKI15460DataMigration.java:223)
              at org.xwiki.notifications.filters.migration.R140401000XWIKI15460DataMigration.internalHibernateMigrate(R140401000XWIKI15460DataMigration.java:159)
              at org.xwiki.notifications.filters.migration.R140401000XWIKI15460DataMigration.hibernateMigrate(R140401000XWIKI15460DataMigration.java:131)
              at com.xpn.xwiki.store.migration.hibernate.AbstractHibernateDataMigration.migrate(AbstractHibernateDataMigration.java:118)
              ... 24 common frames omitted
      Caused by: org.xwiki.user.UserException: Failed to check if document [playground:XWiki.dvincent] holds an XWiki user or not. 
              at org.xwiki.user.internal.document.DocumentUserManager.exists(DocumentUserManager.java:98)
              at org.xwiki.user.internal.document.DocumentUserManager.exists(DocumentUserManager.java:81)
              at org.xwiki.user.internal.DefaultUserManager.exists(DefaultUserManager.java:66)
              at org.xwiki.notifications.filters.migration.R140401000XWIKI15460DataMigration.lambda$identifyRemovedUsers$2(R140401000XWIKI15460DataMigration.java:213)
              at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
              at org.xwiki.notifications.filters.migration.R140401000XWIKI15460DataMigration.identifyRemovedUsers(R140401000XWIKI15460DataMigration.java:207)
              ... 27 common frames omitted
      Caused by: com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document [playground:XWiki.dvincent()]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1161)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:395)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2164)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2226)
              at org.xwiki.user.internal.document.DocumentUserManager.exists(DocumentUserManager.java:94)
              ... 32 common frames omitted
      Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
              at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
              at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37)
              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:4521)
              at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4511)
              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:2835)
              at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.lambda$load$1(SessionImpl.java:2812)
              at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.perform(SessionImpl.java:2768)
              at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2812)
              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:1032)
              ... 36 common frames omitted
      Caused by: java.sql.SQLSyntaxErrorException: (conn=3032) Unknown column 'xwikidocum0_.XWD_ORIGINAL_METADATA_AUTHOR' in 'field list'
              at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:280)
              at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:368)
              at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:137)
              at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:833)
              at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:772)
              at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:691)
              at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:634)
              at org.mariadb.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:95)
              at org.mariadb.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:288)
              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)
              ... 59 common frames omitted
      

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: