Rollback / migrate external merge request diffs from object storage to database

Problem to solve

GitLab includes a feature that permits merge request diffs to be stored in object storage, rather than in the database: https://docs.gitlab.com/ee/administration/merge_request_diffs.html#using-external-storage . However, if we change our mind about storage, or encounter problems in the rollout, there's no way to migrate the diffs back in-database.

Intended users

  • Sidney (Systems Administrator)

Further details

This came up in the GitLab.com infra issue to roll out object storage: https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7356#note_253467652

@cmiskell has noted that it would be good to have the rollback capability before pushing this to GitLab.com

Proposal

Introduce a method to move the diffs out of object storage and back into the database

Permissions and Security

Admin-accessible only. It might be fine for this to be rails-console-only in the first iteration.

Documentation

https://docs.gitlab.com/ee/administration/merge_request_diffs.html

Testing

We should ensure that rollback is effective and removes the object store document as well. If storing in the database fails, we shouldn't remove the object store document. If that succeeds, but removing the document fails, we should at least log that and make sure it's possible to re-attempt removing the document.

Links / references

Assignee Loading
Time tracking Loading