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

Modification of labels can cause a database error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 7.19.0
    • 7.14.0
    • API - REST

      Issue Summary

      Much like BSERV-12860, there are no unique constraints on the table bb_label_mapping. This could cause duplicates in the table with same label_id, labelable_id and labelable_type.

      Steps to Reproduce

      Expected Results

      Actual Results

      The below exception is thrown in the atlassian.bitbucket.log file:
      Upon running a DELETE command against REST call

      /rest/api/latest/projects/{projectKey}/repos/{repo_slug)/labels/{label}
      

      can return the below result.

      2021-11-17 15:06:15,043 DEBUG [http-nio-7990-exec-70] bbuser *1X8W6DVx906x4137511x14 1jjoc9z 127.0.0.1 "DELETE /bitbucket/rest/api/latest/projects/PROJ_name/repos/repo_name/labels/label-namee HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500
      com.atlassian.bitbucket.DataStoreException: A database error has occurred.
      ..
      Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 5
      

      You can see duplicates in bb_label_mapping (With same label_id, labelable_id and labelable_type).

      Workaround

      Delete the duplicates manually from the database

              khughes@atlassian.com Kristy
              46ac2648bc84 Naveen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: