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: ...@@ -9,7 +9,7 @@ production:
username: git username: git
password: "secure password" password: "secure password"
host: localhost host: localhost
# fdw: false fdw: true
# #
# Development specific # Development specific
...@@ -22,7 +22,7 @@ development: ...@@ -22,7 +22,7 @@ development:
username: postgres username: postgres
password: "secure password" password: "secure password"
host: localhost host: localhost
# fdw: false fdw: true
# #
# Staging specific # Staging specific
...@@ -35,7 +35,7 @@ staging: ...@@ -35,7 +35,7 @@ staging:
username: git username: git
password: "secure password" password: "secure password"
host: localhost host: localhost
# fdw: false fdw: true
# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake". # re-generated from your development database when you run "rake".
...@@ -48,4 +48,4 @@ test: &test ...@@ -48,4 +48,4 @@ test: &test
username: postgres username: postgres
password: password:
host: localhost host: localhost
# fdw: false fdw: true
...@@ -304,7 +304,7 @@ because we have not yet configured the secondary server. This is the next step. ...@@ -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 connections. The certificate can only be replicated by someone with access
to the private key, which is **only** present on the primary node. 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. 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. We need to enable this, to enable FDW support, even if using a single node.
......
...@@ -263,7 +263,7 @@ node. ...@@ -263,7 +263,7 @@ node.
bundle exec rake geo:db:migrate 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 Save the script below in a file, ex. `/tmp/geo_fdw.sh` and modify the connection
params to match your environment. params to match your environment.
......
...@@ -76,9 +76,9 @@ module Gitlab ...@@ -76,9 +76,9 @@ module Gitlab
def self.fdw? def self.fdw?
return false unless self.fdw_capable? return false unless self.fdw_capable?
# FDW is disabled by default: https://gitlab.com/gitlab-org/gitlab-ee/issues/4558 # FDW is enabled by default, disable it by setting `fdw: false` in config/database_geo.yml
# Enable it by setting `fdw: true` in config/database_geo.yml value = Rails.configuration.geo_database['fdw']
Rails.configuration.geo_database.fetch('fdw', false) value.nil? ? true : value
end end
def self.fdw_table(table_name) def self.fdw_table(table_name)
......
...@@ -46,15 +46,15 @@ describe Gitlab::Geo, :geo do ...@@ -46,15 +46,15 @@ describe Gitlab::Geo, :geo do
expect(described_class.fdw?).to be_falsey expect(described_class.fdw?).to be_falsey
end end
context 'fdw capable' do context 'with fdw capable' do
before do before do
allow(described_class).to receive(:fdw_capable?).and_return(true) allow(described_class).to receive(:fdw_capable?).and_return(true)
end end
it 'returns false by default' do it 'returns true by default' do
allow(Rails.configuration).to receive(:geo_database).and_return('fdw' => nil) 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 end
it 'returns false if configured in `config/database_geo.yml`' do 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