Explain missing Geo registry tables in geo:status
What does this MR do and why?
gitlab-rake geo:status builds a GeoNodeStatus, which counts every registry table in the tracking database. When the Geo migrations were never run or stopped part way, the task died with a raw PG::UndefinedTable: relation "ci_secure_file_registry" does not exist for whichever registry table came first, giving the administrator nothing to act on.
This MR makes gitlab:geo:status check for pending tracking database migrations on a secondary before it builds the status. When migrations are pending, the task aborts with the db:migrate:status:geo and db:migrate:geo commands and a link to the Geo troubleshooting page.
The issue also suggests a documentation update; I have kept this MR to the code change and can follow up on the docs separately if the maintainers want a dedicated section.
References
- Resolves #565971 (closed)
Differences
Before: On a secondary whose tracking database is missing registry tables, gitlab-rake geo:status raises ActiveRecord::StatementInvalid: PG::UndefinedTable.
After: The task aborts with: "The Geo tracking database is missing these registry tables: ci_secure_file_registry" followed by the two rake commands to run and the docs link.
How to set up and validate locally
- On a Geo secondary (or in a Rails console with a tracking database), drop one registry table, for example
Geo::TrackingBase.connection.drop_table(:ci_secure_file_registry). - Run
bundle exec rake geo:status. - On
masterit raises; with this MR it prints the actionable message and exits 1.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.