Database migration failed

Troubleshooting Databases

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

The following appears in the atlassian-stash.log:

2013-01-24 07:24:22,259 INFO  [NioProcessor-4]  org.apache.sshd.server.kex.DHG14 Received SSH_MSG_KEXDH_INIT
2013-01-24 07:24:22,259 INFO  [NioProcessor-3]  org.apache.sshd.server.kex.DHG14 Received SSH_MSG_KEXDH_INIT
2013-01-24 07:24:22,260 DEBUG [threadpool:thread-8] admin 443x1342x1 1l6k8gy 86.86.65.13 "POST /admin/db/edit HTTP/1.1" c.a.s.i.backup.AbstractBackupSupport Successfully deleted unpacked files from /home/admin/stash-home/tmp/migration-admin-20130124-072356-019.zip-unpack5677593955209237819.backup
2013-01-24 07:24:22,266 ERROR [threadpool:thread-8] admin 443x1342x1 1l6k8gy 86.86.65.13 "POST /admin/db/edit HTTP/1.1" c.a.s.i.m.DefaultMigrationService Reverting database configuration after a failed migration attempt
com.atlassian.activeobjects.spi.ActiveObjectsImportExportException: There was an error during import/export with plugin Atlassian Stash SSH Plugin(com.atlassian.stash.ssh-plugin) #2.0.0 (table AO_FB71B4_PUBLIC_KEY):Error executing update for SQL statement 'CREATE TABLE AO_FB71B4_PUBLIC_KEY (
    ID INTEGER AUTO_INCREMENT,
    KEY_MD5 VARCHAR(255),
    KEY_TEXT TEXT,
    USER_ID INTEGER,
    PRIMARY KEY(ID)
) ENGINE=InnoDB'
	at com.atlassian.activeobjects.backup.ImportExportErrorServiceImpl.newImportExportSqlException(ImportExportErrorServiceImpl.java:30) ~[na:na]
	at com.atlassian.activeobjects.backup.SqlUtils.onSqlException(SqlUtils.java:53) ~[na:na]
	at com.atlassian.activeobjects.backup.SqlUtils.executeUpdate(SqlUtils.java:42) ~[na:na]
	at com.atlassian.activeobjects.backup.ActiveObjectsTableCreator.create(ActiveObjectsTableCreator.java:84) ~[na:na]
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'AO_FB71B4_PUBLIC_KEY' already exists

Cause

Race condition occurs when a git client attempts to interact with Stash via SSH while the migration is in progress.

Workaround

 

  1. Recreate the target database to have an empty database
  2. Shut down the SSH server on the Administration >> Server Settings page
  3. Perform the database migration
  4. Start the SSH server back up

Resolution

Upgrade to Stash 2.1.0+ that has fixed the bug STASH-3053 - Getting issue details... STATUS

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.