Skip to content

500 errors on secondary geo server after enabling FDW

https://sentry.gitlap.com/gitlab/geo1/issues/117026/

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "users" does not exist
LINE 1: SELECT  "users".* FROM "users" WHERE "users"."id" = 1506003 ...
                               ^
: SELECT  "users".* FROM "users" WHERE "users"."id" = 1506003  ORDER BY "users"."id" ASC LIMIT 1

It looks like the foreign server is configured correctly:

# /opt/gitlab/bin/gitlab-geo-psql template1
 gitlabhq_geo_production=# \des+
                                                                                 List of foreign servers
       Name       |    Owner    | Foreign-data wrapper |       Access privileges       | Type | Version |                           FDW Options                            | Description
------------------+-------------+----------------------+-------------------------------+------+---------+------------------------------------------------------------------+-------------
 gitlab_secondary | gitlab-psql | postgres_fdw         | "gitlab-psql"=U/"gitlab-psql"+|      |         | (host '10.209.1.101', port '6432', dbname 'gitlabhq_production') |
                  |             |                      | gitlab_geo=U/"gitlab-psql"    |      |         |                                                                  |
(1 row)