Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-61369

Migration from Cloud to Server fail due to column constraints

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Summary

      Migration from Cloud to Server sometimes fails due to the column constraints on AO_ED979B_EVENTPROPERTY. This is a JIRA Mobile table.

      [c.a.j.bc.dataimport.DefaultDataImportService] Error during ActiveObjects restore
      com.atlassian.activeobjects.spi.ActiveObjectsImportExportException: There was an error during import/export with <unknown plugin> (table AO_ED979B_EVENTPROPERTY):
              at com.atlassian.activeobjects.backup.ImportExportErrorServiceImpl.newImportExportSqlException(ImportExportErrorServiceImpl.java:26)
              at com.atlassian.dbexporter.importer.DataImporter$BatchInserter.flush(DataImporter.java:429)
              at com.atlassian.dbexporter.importer.DataImporter$BatchInserter.executePS(DataImporter.java:412)
              at com.atlassian.dbexporter.importer.DataImporter$BaseInserter.execute(DataImporter.java:378)
              at com.atlassian.dbexporter.importer.DataImporter.importTable(DataImporter.java:114)
              at com.atlassian.dbexporter.importer.DataImporter.access$000(DataImporter.java:41)
              at com.atlassian.dbexporter.importer.DataImporter$1.call(DataImporter.java:71)
              at com.atlassian.dbexporter.importer.DataImporter$1.call(DataImporter.java:64)
              at com.atlassian.dbexporter.jdbc.JdbcUtils.withConnection(JdbcUtils.java:28)
              at com.atlassian.dbexporter.importer.DataImporter.doImportNode(DataImporter.java:64)
              at com.atlassian.dbexporter.importer.AbstractImporter.importNode(AbstractImporter.java:44)
              at com.atlassian.dbexporter.DbImporter.importData(DbImporter.java:69)
              at com.atlassian.activeobjects.backup.ActiveObjectsBackup.restore(ActiveObjectsBackup.java:151)
              at com.atlassian.jira.bc.dataimport.DefaultDataImportService.restoreActiveObjects(DefaultDataImportService.java:555)
              at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:710)
              at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:320)
              at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.call(DataImportAsyncCommand.java:60)
              at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.call(DataImportAsyncCommand.java:28)
              at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:157)
              at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:133)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.sql.BatchUpdateException: ORA-12899: value too large for column "JIRADBUSER"."AO_ED979B_EVENTPROPERTY"."VALUE" (actual: 258, maximum: 255)
       
              at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:11190)
              at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:244)
              at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
              at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
              ... 24 more
      

      Details on the issue

      jira=> \d  "AO_ED979B_EVENTPROPERTY"
                                         Table "public.AO_ED979B_EVENTPROPERTY"
        Column  |          Type          |                               Modifiers                                
      ----------+------------------------+------------------------------------------------------------------------
       EVENT_ID | integer                | not null
       ID       | integer                | not null default nextval('"AO_ED979B_EVENTPROPERTY_ID_seq"'::regclass)
       KEY      | character varying(255) | not null
       VALUE    | character varying(255) | 
      Indexes:
          "AO_ED979B_EVENTPROPERTY_pkey" PRIMARY KEY, btree ("ID")
          "index_ao_ed979b_eve1511666309" btree ("EVENT_ID")
      
      

      The default constraints for the value column for the AO_ED979B_EVENTPROPERTY is 255. Migration from Cloud to Server fails because there are data that exceeds 255 character.

      Steps to Replicate

      This happens because the table has a limit of 255 characters and when Oracle imports the data it thinks that it has more characters. This happens cause the column is not configured correctly when imported.
      To reproduce this just create comments in issues of more than 255 characters and then try to export the data to an Oracle DB

      Workaround

      1) Before importing (make sure that the Database is empty) edit the activeobjects.xml
      2) find the table and change the precision to more than 255.
      This is how it looks:

      <table name="AO_ED979B_EVENTPROPERTY">
      <column name="EVENT_ID" primaryKey="false" autoIncrement="false" sqlType="4" precision="10"/>
      <column name="ID" primaryKey="true" autoIncrement="true" sqlType="4" precision="10"/>
      <column name="KEY" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
      <column name="VALUE" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
      </table>
      

      You should change this line to something like this:

      <column name="VALUE" primaryKey="false" autoIncrement="false" sqlType="12" precision="512"/>
      

      Attachments

        Issue Links

          Activity

            People

              ckhatchikian Carlos Khatchikian
              vchin Vincent Chin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: