Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-18019

Unused repositories are not getting pruned from the database

    XMLWordPrintable

Details

    Description

      Summary

      Unused repository configuration is not getting removed from the database as part of the removeUnusedRepositories job.

      Environment

      • Bamboo connected to PostgreSQL database.
      • Bamboo connected to Oracle database.

      Steps to Reproduce

      Repositories are cleaned up on two different events, both trigger the removeUnusedRepositories job:

      1. When a build plan is deleted.
      2. When Expiry is run (Bamboo administration >> Overview >> Plans >> Expiry).
      Bamboo 5.10.3

      There are two cases cases where MARKED_FOR_DELETION is set to TRUE but the repository definition is not deleted - when it still has a reference in any of the following tables:

      1. VCS_LOCATION_ID column (from REPOSITORY_CHANGESET table)
      2. VCS_LOCATION_ID column (from DEPLOYMENT_VERSION_CHANGESET table)
      Bamboo 5.14.1

      There are three cases cases where MARKED_FOR_DELETION is set to TRUE but the repository definition is not deleted - when it still has a reference in any of the following tables:

      1. VCS_LOCATION_ID column (from REPOSITORY_CHANGESET table)
      2. VCS_LOCATION_ID column (from DEPLOYMENT_VERSION_CHANGESET table)
      3. PARENT_ID column (from VCS_LOCATION table)

      Expected Results

      If the repository definition is marked for deletion and does not contain a reference to it in any of the tables/columns mentioned above, it should be removed as part of the removeUnusedRepositories job.

      Actual Results

      The removeUnusedRepositories job is indeed executed every time a plan is deleted or the Expiry process is run:

      Bamboo 5.10.3
      delete 
        from VCS_LOCATION 
       where MARKED_FOR_DELETION=?
         and  not (exists (select repository1_.REPOSITORY_CHANGESET_ID 
                             from REPOSITORY_CHANGESET repository1_ 
                            where repository1_.VCS_LOCATION_ID=VCS_LOCATION_ID)) 
         and  not (exists (select mutabledep2_.DEP_VERSION_CHANGESET_ID 
                             from DEPLOYMENT_VERSION_CHANGESET mutabledep2_ 
                            where mutabledep2_.VCS_LOCATION_ID=VCS_LOCATION_ID))
      
      Bamboo 5.14.1
      delete 
        from VCS_LOCATION 
       where MARKED_FOR_DELETION=?
         and  not (exists (select repository1_.REPOSITORY_CHANGESET_ID 
                             from REPOSITORY_CHANGESET repository1_ 
                            where repository1_.VCS_LOCATION_ID=VCS_LOCATION_ID)) 
         and  not (exists (select mutabledep2_.DEP_VERSION_CHANGESET_ID 
                             from DEPLOYMENT_VERSION_CHANGESET mutabledep2_ 
                            where mutabledep2_.VCS_LOCATION_ID=VCS_LOCATION_ID)) 
         and  not (exists (select repository3_.VCS_LOCATION_ID 
                             from VCS_LOCATION repository3_ 
                            where repository3_.PARENT_ID=VCS_LOCATION_ID))
      

      If you turn any of the DELETE queries above into SELECT queries they always return empty, despite the repository configuration does not contain any references anymore.

      The repository definition is not removed from the database.

      Attachments

        Activity

          People

            mgardias Marcin Gardias
            brosa Bruno Rosa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: