Site export/import fails on MySQL database with JDBC Driver 8.0.26

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 7.12.4
    • None
    • 3
    • Severity 2 - Major
    • 3

      Issue Summary

      On MySQL database, if the JDBC driver version 8.0.26 is used, then export of the site to XML will produce corrupted and unimportable archive.

      This issue is caused by the bug in MySQL JDBC Driver. It's reproducible now only on version 8.0.26 (and possibly later releases until the bug is fixed).

      The bug can also affect Cloud Migrations, because the produced export file is corrupted.

      Steps to Reproduce

      1. Provision 1-node DC with MySQL database using JDBC Driver 8.0.26
      2. Go through all setup steps (choose empty site, create a space and the page in the end)
      3. Perform the site export to ZIP archive
      4. Perform site import of the same archive

      The problem happens during site export. It generates duplicated FK in the XML file, which is predictably fails during the import.

        <table name="AO_9412A1_USER_APP_LINK">
          <column name="APPLICATION_LINK_ID" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
          <column name="AUTH_VERIFIED" primaryKey="false" autoIncrement="false" sqlType="-7" precision="1"/>
          <column name="CREATED" primaryKey="false" autoIncrement="false" sqlType="93" precision="19"/>
          <column name="ID" primaryKey="true" autoIncrement="true" sqlType="-5" precision="19"/>
          <column name="UPDATED" primaryKey="false" autoIncrement="false" sqlType="93" precision="19"/>
          <column name="USER_ID" primaryKey="false" autoIncrement="false" sqlType="-5" precision="19"/>
          <foreignKey fromTable="AO_9412A1_USER_APP_LINK" fromColumn="USER_ID" toTable="AO_9412A1_AOUSER" toColumn="ID"/>
          <foreignKey fromTable="AO_9412A1_USER_APP_LINK" fromColumn="USER_ID" toTable="AO_9412A1_AOUSER" toColumn="ID"/>
        </table>
      

      Because the problem is originated in the MySQL driver and is not caused by Confluence, I've also created a unit test that reproduces the problem: https://github.com/badgersow/mysql-duplicate-fk-bug

      Expected Results

      The import finishes successfully

      Actual Results

      Import throws an exception (see screenshot and the stack trace).

      Caused by: java.sql.SQLSyntaxErrorException: Table 'confluence.AO_9412A1_AONOTIFICATION' doesn't exist
              at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
              at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
              at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
              at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)
              at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:1471)
              at net.java.ao.ForwardingPreparedStatement.executeQuery(ForwardingPreparedStatement.java:40)
              at net.java.ao.ParameterMetadataCachingPreparedStatement.executeQuery(ParameterMetadataCachingPreparedStatement.java:10)
              at net.java.ao.EntityManager.stream(EntityManager.java:889)
              at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.stream(EntityManagedActiveObjects.java:174)
              ... 475 more
      

      Workaround

      If the duplicated FK lines are removed manually from the xml file prior to import, the import will work. The bug manifests itself by producing multiple identical FK definitions.

            Assignee:
            George Lipatov
            Reporter:
            Efim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: