Excessive number of merge request diffs on merge requests from forked projects
We saw a common pattern in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5215#note_111612491 where a number of stale merge requests from forked projects had thousands of merge request diffs. For example:
For every push to master
, UpdateMergeRequestsWorker
would attempt to refresh these merge requests because they were open. For some reason, the merge request diff count increased. We also saw statement timeouts in https://sentry.gitlab.net/gitlab/gitlabcom/issues/541143/events/12299302/ from hundreds of requests trying to update the latest_merge_request_id
field. This led to the update_merge_requests
queue not being drained in Sidekiq.
Closing these merge requests seems to have worked around the problem by skipping updates.
I've checked other old merge requests, and they have a single merge request diff as they should.
How did this happen, and how can we fix this?
/cc: @smcgivern, @dzaporozhets