Skip to content

projects_controller: Use "eager" strategy when requesting housekeeping

Patrick Steinhardt requested to merge pks-eager-manual-housekeeping into master

What does this MR do and why?

A project's administrator can explicitly request a housekeeping job to be run in their project's repository. While this is usually not required to be run manually as Rails will automatically execute housekeeping jobs on a regular schedule, there may be situations where an administrator knows that a repository is currently not in an optimal state. This feature is for example used regularly during incidents.

Now with the recent migration towards using heuristical housekeeping via OptimizeRepository this feature got less useful. Even though we still spawn the housekeeping job and run OptimizeRepository, due to the default strategy being based on heuristics we cannot guarantee that Gitaly would do anything in that repository.

To fix this usecase, Gitaly has introduced a new "eager" housekeeping strategy. Instead of inspecting the on-disk state and deciding based on that what we'll optimize, this strategy will instead eagerly optimize all data structueres. While this strategy should not be ran by default due to it being inefficient, it does make sense to use it in the context where an administrator has explicitly asked for repository housekeeping.

Wire up the logic so that we use eager housekeeping when explicitly requested.

Closes #388095 (closed).

How to set up and validate locally

  1. Enable eager housekeeping.
    Feature.enable(:eager_housekeeping_on_manual_jobs)
  2. Visit any project's "General" settings.
  3. Expand the "Advanced" section.
  4. Click "Run housekeeping" button.

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 Patrick Steinhardt

Merge request reports