Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-8881

AO triggers are missing with the Backup Client when using Oracle JDBC driver 12.1.0.2

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Medium Medium
    • None
    • 3.11.2, 4.7.1
    • None
    • None

      Summary

      Using the Backup Client with Oracle JDBC driver 12.1.0.2 doesn't properly export the Active Objects tables trigger definitions.

      Environment

      • Stash 3.11 and Bitbucket Server 4.7.1
      • Oracle Database 12c Enterprise Edition Release 12.1.0.2.0
      • Backup Client 1.9.1 and 2.0.0

      Steps to Reproduce

      1. Connect Bitbucket Server to an Oracle database
      2. Replace the existing ojdbc7 driver from the <Bitbucket Server Installation>/lib folder with the 12.0.1.2.
      3. Generate a backup using the Backup Client

      Expected Results

      Trigger definitions for Active Object tables are exported.
      This can be inspected by extracting the Backup tar file and browsing the active-objects-data.xml file.
      Using the table AO_FB71B4_SSH_PUBLIC_KEY as an example, we would expect the autoIncrement attribute for the ENTITY_ID column definition (the primary key) set to true, as following:

        <table name="AO_FB71B4_SSH_PUBLIC_KEY">
          <column name="ENTITY_ID" primaryKey="true" autoIncrement="true" sqlType="2" precision="11"/>
          <column name="KEY_MD5" primaryKey="false" autoIncrement="false" sqlType="12" precision="32"/>
          <column name="KEY_TEXT" primaryKey="false" autoIncrement="false" sqlType="2005" precision="2147483647"/>
          <column name="LABEL" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
          <column name="USER_ID" primaryKey="false" autoIncrement="false" sqlType="2" precision="11"/>
        </table>
      

      Actual Results

      The primary keys for the tables in the active-objects-data.xml file have their autoIncrement attribute set to false.
      Using the previous example (AO_FB71B4_SSH_PUBLIC_KEY.ENTITY_ID)

        <table name="AO_FB71B4_SSH_PUBLIC_KEY">
          <column name="ENTITY_ID" primaryKey="true" autoIncrement="false" sqlType="2" precision="11"/>
          <column name="KEY_MD5" primaryKey="false" autoIncrement="false" sqlType="12" precision="32"/>
          <column name="KEY_TEXT" primaryKey="false" autoIncrement="false" sqlType="2005" precision="2147483647"/>
          <column name="LABEL" primaryKey="false" autoIncrement="false" sqlType="12" precision="255"/>
          <column name="USER_ID" primaryKey="false" autoIncrement="false" sqlType="2" precision="11"/>
        </table>
      

      Business Impact
      Restoring this backup into a Bitbucket Server instance will result in the triggers not being created and several pieces of functionality to break. For instance, adding a new SSH key results in the following error:

      2016-06-20 07:51:45,406 ERROR [http-nio-8443-exec-1] @1asbx471x222x1 user 10.16.5.228,172.17.42.1 "POST /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController There was an unhandled exception loading [/stash/plugins/servlet/ssh/account/keys/add]
      com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
      Database:
      	- name:Oracle
      	- version:Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
      With the Partitioning and Automatic Storage Management options
      	- minor version:1
      	- major version:12
      Driver:
      	- name:Oracle JDBC driver
      	- version:12.1.0.2.0
      
      java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("STASH"."AO_FB71B4_SSH_PUBLIC_KEY"."ENTITY_ID")
      

      The following other actions can also be impacted:

      • Build status' can not be updated/added
      • Branch permissions cannot be modified/created

      Workaround

      Use the Oracle JDBC 12.1.0.1 driver to perform the backup.
      Alternatively, use the DIY Backup.

              Unassigned Unassigned
              jethomas Jeff Thomas
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: