Skip to content

Manually triggering housekeeping run may not optimize the repository

We have recently migrated Rails to exclusively use the OptimizeRepository() RPC to optimize repositories. This RPC call is a black box to Rails: it only tells Gitaly to do "something", but Gitaly may or may not optimize data structures depending on the current state of the repository.

While this is great during normal housekeeping, one usecase is for administrators to manually trigger a housekeeping run via the "Run housekeeping" button in a project's general settings. This button now has the same beahviour, where an administrator cannot tell whether Gitaly did or did not optimize the repository. The button is frequently used in the context of incidents though, where one really wants to trigger housekeeping tasks.

Gitaly has thus recently introduced a new "eager" housekeeping strategy for OptimizeRepository() that eagerly optimizes the repository. We should adapt the manual trigger to use this new strategy.