Skip to content
Snippets Groups Projects
Commit a93de395 authored by Stan Hu's avatar Stan Hu
Browse files

Expose wal_log_hints PostgreSQL setting

This setting needs to be enabled for pg_rewind to work during a Patroni
failover.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/267144
parent 5b8f9c51
No related branches found
No related tags found
No related merge requests found
---
title: Expose wal_log_hints PostgreSQL setting
merge_request: 4642
author:
type: added
Loading
Loading
@@ -1036,6 +1036,7 @@ gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = nil
### Replication settings
###! Note, some replication settings do not require a full restart. They are documented below.
# postgresql['wal_level'] = "hot_standby"
# postgresql['wal_log_hints'] = 'off'
# postgresql['max_wal_senders'] = 5
# postgresql['max_replication_slots'] = 0
# postgresql['max_locks_per_transaction'] = 128
Loading
Loading
Loading
Loading
@@ -119,6 +119,7 @@ default['gitlab']['geo-postgresql']['default_statistics_target'] = 1000
 
# Replication settings
default['gitlab']['geo-postgresql']['wal_level'] = 'minimal'
default['gitlab']['geo-postgresql']['wal_log_hints'] = 'off'
default['gitlab']['geo-postgresql']['max_wal_senders'] = 0
default['gitlab']['geo-postgresql']['wal_keep_segments'] = 10
default['gitlab']['geo-postgresql']['hot_standby'] = 'off'
Loading
Loading
Loading
Loading
@@ -104,6 +104,7 @@ default['postgresql']['log_rotation_size'] = nil
# Replication settings
default['postgresql']['sql_replication_user'] = "gitlab_replicator"
default['postgresql']['wal_level'] = "minimal"
default['postgresql']['wal_log_hints'] = "off"
default['postgresql']['max_wal_senders'] = 0
default['postgresql']['wal_keep_segments'] = 10
default['postgresql']['hot_standby'] = "off"
Loading
Loading
Loading
Loading
@@ -171,6 +171,7 @@ shared_preload_libraries = '<%= @shared_preload_libraries %>' # (change requi
# - Settings -
 
wal_level = <%= @wal_level %>
wal_log_hints = <%= @wal_log_hints %> # also do full page writes of non-critical updates
# (change requires restart)
#fsync = on # turns forced synchronization on or off
#wal_sync_method = fsync # the default is the first option
Loading
Loading
Loading
Loading
@@ -48,6 +48,10 @@ RSpec.describe 'gitlab-ee::geo' do
expect(config_attrs['wal_level']).to eq('hot_standby')
end
 
it 'defines wal_log_hints' do
expect(config_attrs['wal_log_hints']).to eq('off')
end
it 'defines max_wal_senders' do
expect(config_attrs['max_wal_senders']).to eq(10)
end
Loading
Loading
@@ -95,6 +99,10 @@ RSpec.describe 'gitlab-ee::geo' do
expect(config_attrs['wal_level']).to eq('hot_standby')
end
 
it 'defines wal_log_hints' do
expect(config_attrs['wal_log_hints']).to eq('off')
end
it 'defines max_wal_senders' do
expect(config_attrs['max_wal_senders']).to eq(10)
end
Loading
Loading
Loading
Loading
@@ -377,6 +377,14 @@ RSpec.describe 'postgresql 9.6' do
).with_content(/synchronous_standby_names = ''/)
end
 
it 'disables wal_log_hints setting' do
expect(chef_run.node['postgresql']['wal_log_hints']).to eq('off')
expect(chef_run).to render_file(
postgresql_conf
).with_content(/wal_log_hints = off/)
end
it 'does not set dynamic_shared_memory_type by default' do
expect(chef_run).not_to render_file(
postgresql_conf
Loading
Loading
@@ -467,6 +475,22 @@ RSpec.describe 'postgresql 9.6' do
).with_content(/^dynamic_shared_memory_type = none/)
end
end
context 'when wal_log_hints is on' do
before do
stub_gitlab_rb({
postgresql: {
wal_log_hints: 'on'
}
})
end
it 'enables wal_log_hints' do
expect(chef_run).to render_file(
postgresql_conf
).with_content(/^wal_log_hints = on/)
end
end
end
 
context 'renders runtime.conf' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment