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

Upgrading to 5.x fails if there are commit general comments in the DB

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Highest
    • 5.2.2, 5.0.7, 5.1.5
    • 5.0.0, 5.1.0, 5.2.0
    • None
    • None

    Description

      When upgrading to Bitbucket Server 5.x the system will fail to migrate the schema if there are commit general comments in the DB.

      NOTE: Commit general comments are not a full feature of the system. There's no way (and there's never been a way) to create them or display them through the Bitbucket Server UI. However the REST and Java API allow for these comments to be created. Only customers who have used these APIs to create these comments will be affected by this bug.

      The new Comment API migration tasks introduced a new CommentThread entity to be at the root of a conversation and to tie all of its comments together. As part of the 5.0 DB migration tasks for each root comment a thread row is created in the bb_comment_thread table. All comments in the sta_comment table are then copied across to the new bb_comment table. However the tasks are missing a step to create threads for commit general comments so when the system tries to copy those comments across the foreign key from bb_comment to bb_comment_thread is violated and the upgrade fails.

      2017-07-03 15:28:58,425 ERROR [spring-startup]  liquibase classpath:liquibase/master.xml: liquibase/r5_0/upgrade.xml::BSERVDEV-8489-12::jpalacios: Change Set liquibase/r5_0/upgrade.xml::BSERVDEV-8489-12::jpalacios failed.  Error: ERROR: insert or update on table "bb_comment" violates foreign key constraint "fk_bb_comment_thread"
         Detail: Key (thread_id)=(12345) is not present in table "bb_comment_thread". [Failed SQL: insert into bb_comment (
                           id,
                           author_id,
                           comment_text,
                           created_timestamp,
                           entity_version,
                           thread_id,
                           updated_timestamp
                   )
                   select
                           id,
                           author_id,
                           comment_text,
                           created_timestamp,
                           entity_version,
                           id,
                           updated_timestamp
                   from sta_comment
                   where root_id is null]
      

      Attachments

        Issue Links

          Activity

            People

              jpalacios Juan Palacios (Inactive)
              jpalacios Juan Palacios (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: