Why is Security for Bitbucket taking up so much space in my database?
Problem and Symptoms
Tables in your database with the prefix AO_D9E976_
, especially AO_D9E976_INVALID_LINE
, are taking up large amounts of space.
Environment
Security for Bitbucket - versions older than 5.2.4.
Bitbucket Data Center - compatible versions.
Cause
Older versions of Security for Bitbucket did not effectively reduce database usage by cleaning out unreachable scan results. Newer versions manage this space better.
Solution
Install Security for Bitbucket version 5.2.4 or higher. Note that this requires Bitbucket Data Center 9.0.0 or higher. Newer versions of Security for Bitbucket will clean up old data automatically, including for deleted repositories, and for deleted commits as new commits are made to the repository.
Manual Clean-ups using the REST API
You can also run cleanups manually via the REST API. This can be helpful to re-claim space for scans for old commits in repositories not under active development.
Clean up all data
curl -u admin -X DELETE "https://{bitbucket.server}/rest/security/latest/cleanup/all"
where
bitbucket.server
is the URL of your Bitbucket server.
Clean up data for a particular repository
curl -u admin -X DELETE "https://{bitbucket.server}/rest/security/latest/cleanup/projects/{projectKey}/repos/{repositorySlug}"
where
bitbucket.server
is the URL of your Bitbucket server.projectKey
is the key of the project.repoSlug
is the slug (identifier) of the repository.