Skip to content

[CE Backport] Geo: Cache projects_count and wikis_count in SiteStatistic

What does this MR do?

Creates a SiteStatistic model and table to track repositories_count and wikis_count used by the Geo health check API.

Are there points in the code the reviewer needs to double check?

I had to refactor Factory for Projects to fix the initial state creation behavior (so we could test track and untrack correctly for Project Features)

Why was this MR needed?

We tried to optimize the query but there is a limit on how much we can force Postgres to do, and the tentative to create a specific tailored index failed.

This cannot be implemented as a database trigger (see discussion here: https://gitlab.slack.com/archives/C3NBYFJ6N/p1530260766000012), so the alternative is to use ActiveRecord hooks.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ee/issues/6064

Edited by Gabriel Mazetto

Merge request reports