Delete old (non-latest) merge request diffs after merge
At the moment, we store the full (diff) text of every revision on every MR. That takes a lot of space!
I'm not sure that we need all the history once an MR is merged:
- People rarely need to see that.
- If they do, we can go to the repo, as we keep the commits themselves around in hidden refs.
Where we do need the diffs is for calculating the diff portions of the comments, but I think we could add a new merge_request_diff_note_contexts
(or whatever) table for those that are already referenced, which would store the few lines that we show above an outdated comment, and delete the rest.
With https://gitlab.com/gitlab-org/gitlab-ce/issues/37631#note_39707236 identifying the non-latest diffs would be very easy.
Edited by username-removed-443319