Skip to content

Delete repositories without renaming them first

Toon Claes requested to merge toon-no-more-rename-in-remove into master

What does this MR do and why?

Prior to this change, the service responsible of deleting a repository would first rename the repo to +deleted.git and then schedule a worker to delete that 5min later. This is annoying for Gitaly, and Gitaly Cluster in particular, because renames are complicated when there are multiple replicas.

To overcome inconsistency issues when handling a RemoveRepository RPC in Gitaly Cluster, changes were made in gitaly@f328e3f7 (repository: Implement atomic locking semantics for RemoveRepository, 2021-11-30). This makes the rename step in the Repositories::DestroyService unnecessary.

This change removes the rename step and relies on Gitaly to handle the RemoveRepository in an atomic way.

Changelog: performance
Issue: #37086 (closed)

How to set up and validate locally

  1. Create or use an existing project you want to delete
  2. Locate the repository on disk:
    1. Go to the admin page /admin/projects/<group>/<project> and look at "Gitaly relative path"
    2. Check if the show path exists at <gdk-root>/repositories/<gitaly-relative-path>
  3. Delete it from the UI (in the project settings)
  4. Immediately check if the repo was removed and there does not exists a <gdk-root>/repositories/<gitaly-relative-path>+deleted.git

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Toon Claes

Merge request reports