Staging: pgbouncer pointing to incorrect DB
On staging, queries to FDW tables are not matching with queries to the real tables.
[ gstg ] production> ProjectRepositoryState.count
=> 0
[ gstg ] production> Geo::Fdw::ProjectRepositoryState.count
=> 3068953
which led to
ActiveRecord::Base.connection_config => :host=>"postgres-01-db-gstg.c.gitlab-staging-1.internal", :port=>5432
Geo::TrackingBase.connection.execute("SELECT * from pg_foreign_server").values => host=pgbouncer-01-db-gstg.c.gitlab-staging-1.internal,port=6432
But
cat /var/opt/gitlab/consul/databases.ini
[databases]
gitlabhq_production = host=postgres-02-db-gstg.c.gitlab-staging-1.internal auth_user=pgbouncer
We're expecting postgres-01-db-gstg.c.gitlab-staging-1.internal but it seems pgbouncer is configured for postgres-02-db-gstg.c.gitlab-staging-1.internal
/cc @eReGeBe @nick.thomas