MigrationException when migrating to a MySQL database

Troubleshooting Databases

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

問題

While trying to migrate Stash database to MySQL via UI it fails and the following appears in the atlassian-stash.log:

2015-06-29 19:00:00,000 ERROR [threadpool:thread-1052] admin @1LR5NQ2x1172x39161x1 xzgmic 127.0.0.1,0:0:0:0:0:0:0:1 "POST /admin/db/edit HTTP/1.1" c.a.s.i.m.m.BaseMigrationTask Reverting database configuration after a failed migration attempt
com.atlassian.stash.internal.migration.MigrationException: Backup of Active Objects data from /opt/stash-home/tmp/backup-admin-20150630-003316-417Z.zip-unpack2131549050436166442.backup/active-objects-data.xml could not be restored.
    at com.atlassian.stash.internal.maintenance.restore.ActiveObjectsRestoreStep.run(ActiveObjectsRestoreStep.java:73) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask$Step.run(CompositeMaintenanceTask.java:130) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask.run(CompositeMaintenanceTask.java:69) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.restore.RestorePhase.run(RestorePhase.java:26) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask$Step.run(CompositeMaintenanceTask.java:130) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask.run(CompositeMaintenanceTask.java:69) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask$Step.run(CompositeMaintenanceTask.java:130) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.CompositeMaintenanceTask.run(CompositeMaintenanceTask.java:69) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.MaintenanceModePhase.run(MaintenanceModePhase.java:27) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.migration.BaseMigrationTask.run(BaseMigrationTask.java:67) ~[stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.migration.DatabaseMigrationTask.run(DatabaseMigrationTask.java:49) [stash-service-impl-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.DefaultMaintenanceTaskMonitor.run(DefaultMaintenanceTaskMonitor.java:191) [stash-service-impl-3.8.0.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
    at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:73) [stash-platform-3.8.0.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_71]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_71]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
    ... 1 frame trimmed
Caused by: com.atlassian.activeobjects.spi.ActiveObjectsImportExportException: There was an error during import/export with plugin Atlassian Stash Audit Log Plugin(com.atlassian.stash.stash-audit) #3.8.0 (table AO_BD73C3_REPOSITORY_AUDIT):Could not import data in table 'AO_BD73C3_REPOSITORY_AUDIT' column #4, value is too big for column which size limit is 431, value is:
{"project":"PROJECT","repository":"repo","hook":"be.foreach.stash.notifier:my-post-receive-repository-hook","settings":{"branchFilter":"","mailNotification":"true","mailToAddress":"admin@stash.com","mailOverrideFrom":"false","mailFromTemplate":"","mailOverrideSubject":"false","mailSubjectTemplate":"","mailOverrideBody":"false","mailBodyTemplate":"","slackWebHookUrl":"","slackChannels":""}}

    at com.atlassian.activeobjects.backup.ImportExportErrorServiceImpl.newImportExportException(ImportExportErrorServiceImpl.java:24) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter$BaseInserter.setString(DataImporter.java:388) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter$BaseInserter.setValue(DataImporter.java:436) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter.importTable(DataImporter.java:125) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter.access$000(DataImporter.java:35) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter$1.call(DataImporter.java:75) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter$1.call(DataImporter.java:64) ~[na:na]
    at com.atlassian.dbexporter.jdbc.JdbcUtils.withConnection(JdbcUtils.java:31) ~[na:na]
    at com.atlassian.dbexporter.importer.DataImporter.doImportNode(DataImporter.java:63) ~[na:na]
    at com.atlassian.dbexporter.importer.AbstractImporter.importNode(AbstractImporter.java:49) ~[na:na]
    at com.atlassian.dbexporter.DbImporter.importData(DbImporter.java:73) ~[na:na]
    at com.atlassian.activeobjects.backup.ActiveObjectsBackup.restore(ActiveObjectsBackup.java:161) ~[na:na]
    at com.atlassian.stash.internal.plugin.OsgiServiceProxyFactoryImpl$DynamicServiceInvocationHandler.invoke(OsgiServiceProxyFactoryImpl.java:119) ~[stash-platform-3.8.0.jar:na]
    at com.atlassian.stash.internal.maintenance.restore.ActiveObjectsRestoreStep.run(ActiveObjectsRestoreStep.java:63) ~[stash-service-impl-3.8.0.jar:na]
    ... 21 common frames omitted

診断

環境

  • The issue occurs for MySQL database, with Stash using a driver up to version mysql-connector-java-5.1.14.

診断ステップ

  • Check the size of the columns of varchar type of the AO tables in the old and the new database, confirming their size is different.

原因

A bug in the database driver causes the size of the columns to change, thus the migration fails.

ソリューション

Change the MySQL driver used by Stash to a version higher than 5.1.14:

  1. Stop Stash.
  2. Move the mysql-connector-java-5.1.XX-bin.jar driver from <Stash home directory>/lib to a backup location.
    1. We want to make sure that only 1 version of the driver file exists in the lib directory.
  3. Download the latest driver from http://dev.mysql.com/downloads/connector/j/ to <Stash home directory>/lib.
  4. Start Stash.
  5. Attempt the database migration again.
最終更新日 2016 年 3 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.