Commit f1e2fdb0 authored by Toon Claes's avatar Toon Claes

Enable FDW for Geo by default

If the database is set up for that.
parent 67c5debf
......@@ -9,7 +9,7 @@ production:
username: git
password: "secure password"
host: localhost
# fdw: false
fdw: true
#
# Development specific
......@@ -22,7 +22,7 @@ development:
username: postgres
password: "secure password"
host: localhost
# fdw: false
fdw: true
#
# Staging specific
......@@ -35,7 +35,7 @@ staging:
username: git
password: "secure password"
host: localhost
# fdw: false
fdw: true
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
......@@ -48,4 +48,4 @@ test: &test
username: postgres
password:
host: localhost
# fdw: false
fdw: true
......@@ -304,7 +304,7 @@ because we have not yet configured the secondary server. This is the next step.
connections. The certificate can only be replicated by someone with access
to the private key, which is **only** present on the primary node.
1. Optional: Configure PostreSQL to enable FDW support
1. Configure PostreSQL to enable FDW support
This step is similar to how we configured the primary instance.
We need to enable this, to enable FDW support, even if using a single node.
......
......@@ -263,7 +263,7 @@ node.
bundle exec rake geo:db:migrate
```
1. Optional: Configure the [PostgreSQL FDW][FDW] connection and credentials:
1. Configure the [PostgreSQL FDW][FDW] connection and credentials:
Save the script below in a file, ex. `/tmp/geo_fdw.sh` and modify the connection
params to match your environment.
......
......@@ -76,9 +76,9 @@ module Gitlab
def self.fdw?
return false unless self.fdw_capable?
# FDW is disabled by default: https://gitlab.com/gitlab-org/gitlab-ee/issues/4558
# Enable it by setting `fdw: true` in config/database_geo.yml
Rails.configuration.geo_database.fetch('fdw', false)
# FDW is enabled by default, disable it by setting `fdw: false` in config/database_geo.yml
value = Rails.configuration.geo_database['fdw']
value.nil? ? true : value
end
def self.fdw_table(table_name)
......
......@@ -46,15 +46,15 @@ describe Gitlab::Geo, :geo do
expect(described_class.fdw?).to be_falsey
end
context 'fdw capable' do
context 'with fdw capable' do
before do
allow(described_class).to receive(:fdw_capable?).and_return(true)
end
it 'returns false by default' do
it 'returns true by default' do
allow(Rails.configuration).to receive(:geo_database).and_return('fdw' => nil)
expect(described_class.fdw?).to be_falsey
expect(described_class.fdw?).to be_truthy
end
it 'returns false if configured in `config/database_geo.yml`' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment