When a Jira issue has thousands of associated commits, the /rest/remote-link-aggregation/latest/aggregation endpoint in Bitbucket Server runs thousands of queries.
The Jira integration queries Bitbucket for commits related to issue keys. The following queries are run:
This results in the same number of queries to the cs_repo_membership table, and several hundred requests to changeset, resulting high database resource usage and the application eventually becoming unavailable.
- Connect Jira to Bitbucket.
- Create a Jira issue and make several thousand commits in Bitbucket associated with that issue key.
- Monitor the requests made to /rest/remote-link-aggregation/latest/aggregation for that issue key and the associated SQL queries.
The SQL queries are all processed successfully.
These queries run for an extended period of time for tickets with a large number of commits, causing resource issues and Bitbucket to be unavailable.
- Identify any Jira issues with more than 1500 associated commits, using the SQL query below:
- Delete the Jira issues returned by the query.