Fix gitlab:setup failure on fresh database
What does this MR do and why?
Contributes to #591292
Problem
Running gitlab:setup on a fresh PostgreSQL database fails with
PG::UndefinedTable: ERROR: relation "feature_gates" does not exist.
This regression was introduced in 18.9 by
!220200 (merged) which added
a circuit breaker to the Gitaly client. The CircuitBreaker#enabled?
method calls Feature.enabled? before the database schema is
initialized, causing Flipper to query the non-existent feature_gates
table.
Solution
Check Feature::FlipperFeature.table_exists? before calling
Feature.enabled? in CircuitBreaker#enabled?. This follows the
established pattern used in lib/feature/gitaly.rb.
References
- Issue: #591292
- Related MR that introduced the regression: !220200 (merged)
Screenshots or screen recordings
Not applicable - no UI changes.
How to set up and validate locally
- Create a fresh PostgreSQL database (without running migrations)
- Run
bundle exec rake gitlab:setup - Verify the setup completes without
PG::UndefinedTableerrors
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.