Details
-
Bug
-
Resolution: Done
-
Low
-
5.10.3, 5.14.1
-
Severity 3 - Minor
-
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:
- When a build plan is deleted.
- When Expiry is run (Bamboo administration >> Overview >> Plans >> Expiry).
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:
- VCS_LOCATION_ID column (from REPOSITORY_CHANGESET table)
- VCS_LOCATION_ID column (from DEPLOYMENT_VERSION_CHANGESET table)
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:
- VCS_LOCATION_ID column (from REPOSITORY_CHANGESET table)
- VCS_LOCATION_ID column (from DEPLOYMENT_VERSION_CHANGESET table)
- 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:
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))
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.