Uploaded image for project: 'Migration Platform'
  1. Migration Platform
  2. MIG-189

Migration assistant fails in Confluence if not all MIG_ tables exist

    XMLWordPrintable

Details

    • 1
    • Severity 3 - Minor

    Description

      Issue Summary

      If some of the MIG_ tables already exists, but not all of them, the migration assistant won't create the missing tables and will fail.

      Steps to Reproduce

      1. Install a vanilla instance of Confluence – tested with version 7.3.3.
      2. Upgrade Confluence Cloud Migration Assistant to the latest version available – tested with version 2.6.0.
      3. Drop some tables from the database as suggested below; I couldn't determine the trigger on why just some of the tables existed.
        drop table mig_step;
        drop table mig_analytics_event;
        drop table mig_task;
        drop table mig_check_result;
        drop table mig_app_assessment_info;
        drop table mig_detected_event_log;
        drop table mig_attachment;
        drop table mig_plan;
        drop table mig_work_item;
        drop table mig_sequences;
        drop table mig_stats;
        
      4. Access the Migration Assistant page.

      Expected Results

      The App identifies the missing tables and manages to restart in a clean state, creating the necessary tables and cleaning the ones that existed.

      Actual Results

      A System Error page is presented to the administrator with the following stack trace:

      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getInitialState' in  class com.atlassian.migration.agent.web.AppAction threw exception javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet at /templates/app.vm[line 21, column 44]
      	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:228)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.apache.velocity.Template.merge(Template.java:328)
      	at org.apache.velocity.Template.merge(Template.java:235)
      	at com.opensymphony.webwork.dispatcher.VelocityResult.doExecute(VelocityResult.java:91)
      (...)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
      	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1514)
      	at org.hibernate.query.Query.getResultList(Query.java:135)
      	at com.atlassian.migration.agent.store.jpa.impl.DefaultQueryBuilder.prepareFirst(DefaultQueryBuilder.java:198)
      	at com.atlassian.migration.agent.store.jpa.impl.DefaultEntityManagerTemplate.execute(DefaultEntityManagerTemplate.java:30)
      	at com.atlassian.migration.agent.store.jpa.impl.DefaultQueryBuilder.first(DefaultQueryBuilder.java:128)
      	at com.atlassian.migration.agent.store.impl.PlanStoreImpl.hasPlans(PlanStoreImpl.java:81)
      	at com.atlassian.migration.agent.service.impl.DefaultPlanService.lambda$hasPlans$9(DefaultPlanService.java:163)
      	at com.atlassian.migration.agent.store.jpa.impl.DefaultPluginTransactionTemplate.on(DefaultPluginTransactionTemplate.java:40)
      	at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.read(PluginTransactionTemplate.java:16)
      	at com.atlassian.migration.agent.service.impl.DefaultPlanService.hasPlans(DefaultPlanService.java:163)
      	at com.atlassian.migration.agent.service.impl.DefaultInitialStateService.getInitialState(DefaultInitialStateService.java:23)
      	at com.atlassian.migration.agent.web.AppAction.getInitialState(AppAction.java:44)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529)
      	at com.atlassian.velocity.htmlsafe.introspection.AnnotationBoxingPropertyGet.invoke(AnnotationBoxingPropertyGet.java:24)
      	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
      	... 383 more
      Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
      	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
      	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:69)
      	at org.hibernate.loader.Loader.getResultSet(Loader.java:2167)
      	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1930)
      	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1892)
      	at org.hibernate.loader.Loader.doQuery(Loader.java:937)
      	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340)
      	at org.hibernate.loader.Loader.doList(Loader.java:2689)
      	at org.hibernate.loader.Loader.doList(Loader.java:2672)
      	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2506)
      	at org.hibernate.loader.Loader.list(Loader.java:2501)
      	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:504)
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:395)
      	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:220)
      	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1508)
      	at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1537)
      	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1505)
      	... 402 more
      Caused by: org.postgresql.util.PSQLException: ERROR: relation "mig_plan" does not exist
        Position: 27
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310)
      	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
      	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:149)
      	at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:108)
      	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:431)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
      

      Workaround

      The current workaround is to drop all the tables related to the Migration Assistant App following the procedure below.

      1. Stop Confluence.
      2. Run the following queries in the database to drop all tables related to the migration App – use this order.
        drop table mig_step;
        drop table mig_analytics_event;
        drop table mig_db_changelog_lock;
        drop table mig_db_changelog;
        drop table mig_task;
        drop table mig_check_result;
        drop table mig_app_assessment_info;
        drop table mig_detected_event_log;
        drop table mig_attachment;
        drop table mig_plan;
        drop table mig_work_item;
        drop table mig_cloud_site;
        drop table mig_sequences;
        drop table mig_stats;
        
      3. Clear plugins cache by deleting files under the following folders.
            <confluence-home>/bundled-plugins
            <confluence-home>/plugins-cache
            <confluence-home>/plugins-osgi-cache
            <confluence-home>/plugins-temp
            <confluence-home>/bundled-plugins_language
        
      4. Start Confluence.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tmasutti Thiago Masutti
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: