If using Oracle DBMS, Bamboo recreates unique contraints on each restart

XMLWordPrintable

    • Severity 3 - Minor

      Summary

      Bamboo runs ALTER statements on startup to drop and re-create indices, as if Hibernate believes the index/constraint is incorrect.
      The root cause is that Hibernate doesn't name indexes that back up the constraint it creates but it expects the name of the index to match the name of constraint, which is not the case on Oracle (and hsqldb)

      Steps to Reproduce

      1. Add the following row to <bamboo-install>/atlassian-bamboo/WEB-INF/classes/log4j.properties:
        log4j.category.org.hibernate=TRACE
      1. Add a Notification to a Build Plan
      2. Restart Bamboo

      Expected Results

      Bamboo starts up without updating schema

      Actual Results

      The below lines are shown in the atlassian-bamboo.log file, with log level DEBUG or higher on org.hibernate:

      2017-11-07 11:32:07,532 INFO [localhost-startStop-1] [UpgradeLauncher] Updating database schema...
      alter table NOTIFICATIONS drop constraint notifications_unique
      2017-11-07 11:32:27,061 DEBUG [localhost-startStop-1] [SQL] alter table NOTIFICATIONS drop constraint notifications_unique
      alter table NOTIFICATIONS add constraint notifications_unique unique (RECIPIENT_TYPE, RECIPIENT, NOTIFICATION_SET, CONDITION_KEY, CONDITION_DATA)
      2017-11-07 11:32:27,204 DEBUG [localhost-startStop-1] [SQL] alter table NOTIFICATIONS add constraint notifications_unique unique (RECIPIENT_TYPE, RECIPIENT, NOTIFICATION_SET, CONDITION_KEY, CONDITION_DATA)
      

      Workaround

      Manually rename the indices to match the respective constraints.

              Assignee:
              Marcin Gardias
              Reporter:
              Ellie Z
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: