-
Bug
-
Resolution: Fixed
-
Low
-
8.0.4
-
None
-
2
-
Severity 2 - Major
-
Issue Summary
The SQL queries used by Bamboo to identify plans to be expired based on the settings defined at the expiry functionality are very inefficient in instances that contain plans with a huge number of results
Steps to Reproduce
- Have a plan in Bamboo with a huge number of build results (i.e. 300.000)
- Run the expiry
Expected Results
The build results covered by the rules defined at the expiry functionality will be marked to be deleted in a reasonable amount of time.
Actual Results
Some of the queries used by Bamboo to select the plans to be expired can take a lot of time to run, in some scenarios even a couple of days.
In one example, a plan with 303845 results, the query that is used only to get the build number of the oldest build result to keep during build expiry (excluding specs builds):
SELECT MIN(A.BUILD_NUMBER) FROM BUILDRESULTSUMMARY A WHERE A.BUILD_KEY = '<plan-key>' AND A.SPECS_RESULT = FALSE AND ( SELECT COUNT(B.BUILD_NUMBER) FROM BUILDRESULTSUMMARY B WHERE B.SPECS_RESULT = FALSE AND B.BUILD_NUMBER >= A.BUILD_NUMBER AND B.BUILD_KEY = '<plan-key>' ) <= <build results to keep, eg. 1>;
Took more than 2,5 days to get executed:
mysql> SELECT min(a.BUILD_NUMBER) -> FROM BUILDRESULTSUMMARY a -> WHERE a.BUILD_KEY = 'PROJ-PLAN' -> AND a.SPECS_RESULT = 0 -> AND ( -> SELECT count(b.BUILD_NUMBER) -> FROM BUILDRESULTSUMMARY b -> WHERE b.SPECS_RESULT = 0 -> AND b.BUILD_NUMBER >= a.BUILD_NUMBER -> AND b.BUILD_KEY = 'PROJ-PLAN' -> ) <= 1; +---------------------+ | min(a.BUILD_NUMBER) | +---------------------+ | 303845 | +---------------------+ 1 row in set (2 days 12 hours 46 min 10.81 sec)
This situation can escalate if the instance holds more than one plan with a high number of build results.
Workaround
Currently, there is no workaround for this.
[BAM-21705] Running expiry against plans with a lot of results can be very inefficient
Resolution | New: Fixed [ 1 ] | |
Status | Original: Waiting for Release [ 12075 ] | New: Closed [ 6 ] |
Status | Original: In Review [ 10051 ] | New: Waiting for Release [ 12075 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10051 ] |
Remote Link |
New:
This issue links to "+core+ Dogfooding › Test Git Branch Detection › bugfix- |
Status | Original: Short Term Backlog [ 12074 ] | New: In Progress [ 3 ] |
Fix Version/s | New: 8.1.6 [ 100494 ] | |
Fix Version/s | New: 8.2.2 [ 100690 ] | |
Fix Version/s | New: 8.0.7 [ 99693 ] |
Assignee | New: Marcin Gardias [ mgardias ] |
Status | Original: Long Term Backlog [ 12073 ] | New: Short Term Backlog [ 12074 ] |
Status | Original: Needs Triage [ 10030 ] | New: Long Term Backlog [ 12073 ] |
Support reference count | Original: 1 | New: 2 |