[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?
-
Changelog entry added, if necessary -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Conform by the database guides -
End-to-end tests pass ( package-and-qa
manual pipeline job)
What are the relevant issue numbers?
Edited by Gabriel Mazetto