Merge branch 'postgresql-settings' into 'master'

Add more PostgreSQL settings

See merge request gitlab-org/omnibus-gitlab!1973
This commit is contained in:
Marin Jankovski 2017-10-03 10:37:25 +00:00
commit 37799aea3f
7 changed files with 130 additions and 0 deletions

View File

@ -7,6 +7,10 @@ omnibus-gitlab repository.
- Remove unused Grit configuration settings
- Enable profiler for jemalloc
- Added PostgreSQL support for effective_io_concurrency
- Added PostgreSQL support for max_worker_processes and max_parallel_workers_per_gather
- Added PostgreSQL support for log_lock_waits and deadlock_timeout
- Added PostgreSQL support for track_io_timing
10.0.2

View File

@ -680,6 +680,7 @@ external_url 'GENERATED_EXTERNAL_URL'
# postgresql['checkpoint_segments'] = 10
# postgresql['checkpoint_timeout'] = "5min"
# postgresql['checkpoint_completion_target'] = 0.9
# postgresql['effective_io_concurrency'] = 1
# postgresql['checkpoint_warning'] = "30s"
# postgresql['effective_cache_size'] = "1MB"
# postgresql['shmmax'] = 17179869184 # or 4294967295
@ -696,6 +697,11 @@ external_url 'GENERATED_EXTERNAL_URL'
# postgresql['statement_timeout'] = "60000"
# postgresql['idle_in_transaction_session_timeout'] = "60000"
# postgresql['log_line_prefix'] = "%a"
# postgresql['max_worker_processes'] = 8
# postgreslq['max_parallel_workers_per_gather'] = 0
# postgresql['log_lock_waits'] = 1
# postgresql['deadlock_timeout'] = '5s'
# postgresql['track_io_timing'] = 0
### Available in PostgreSQL 9.6 and later
# postgresql['min_wal_size'] = 80MB

View File

@ -101,6 +101,12 @@ default['gitlab']['geo-postgresql']['statement_timeout'] = '60000'
default['gitlab']['geo-postgresql']['idle_in_transaction_session_timeout'] = '60000'
default['gitlab']['geo-postgresql']['log_line_prefix'] = nil
default['gitlab']['geo-postgresql']['track_activity_query_size'] = '1024'
default['gitlab']['geo-postgresql']['effective_io_concurrency'] = 1
default['gitlab']['geo-postgresql']['max_worker_processes'] = 8
default['gitlab']['geo-postgresql']['max_parallel_workers_per_gather'] = 0
default['gitlab']['geo-postgresql']['log_lock_waits'] = 1
default['gitlab']['geo-postgresql']['deadlock_timeout'] = '5s'
default['gitlab']['geo-postgresql']['track_io_timing'] = 'off'
# Replication settings
default['gitlab']['geo-postgresql']['wal_level'] = 'minimal'

View File

@ -426,6 +426,12 @@ default['gitlab']['postgresql']['max_locks_per_transaction'] = 128
default['gitlab']['postgresql']['log_temp_files'] = -1
default['gitlab']['postgresql']['log_checkpoints'] = 'off'
default['gitlab']['postgresql']['custom_pg_hba_entries'] = {}
default['gitlab']['postgresql']['effective_io_concurrency'] = 1
default['gitlab']['postgresql']['max_worker_processes'] = 8
default['gitlab']['postgresql']['max_parallel_workers_per_gather'] = 0
default['gitlab']['postgresql']['log_lock_waits'] = 1
default['gitlab']['postgresql']['deadlock_timeout'] = '5s'
default['gitlab']['postgresql']['track_io_timing'] = 'off'
# Replication settings
default['gitlab']['postgresql']['sql_replication_user'] = "gitlab_replicator"

View File

@ -113,6 +113,18 @@ statement_timeout = <%= @statement_timeout %>
idle_in_transaction_session_timeout = <%= @idle_in_transaction_session_timeout %>
<% end %>
# IO settings
effective_io_concurrency = <%= @effective_io_concurrency %>
track_io_timing = '<%= @track_io_timing %>'
# Parallel worker settings
max_worker_processes = <%= @max_worker_processes %>
max_parallel_workers_per_gather = <%= @max_parallel_workers_per_gather %>
# Deadlock handling and logging
deadlock_timeout = '<%= @deadlock_timeout %>'
log_lock_waits = <%= @log_lock_waits %>
# - Locale and Formatting -
datestyle = 'iso, mdy'

View File

@ -262,6 +262,54 @@ describe 'geo postgresql 9.6' do
runtime_conf
).with_content(/hot_standby_feedback = off/)
end
it 'sets effective_io_concurrency' do
expect(chef_run.node['gitlab']['geo-postgresql']['effective_io_concurrency'])
.to eq(1)
expect(chef_run).to render_file(runtime_conf)
.with_content(/effective_io_concurrency = 1/)
end
it 'sets max_worker_processes' do
expect(chef_run.node['gitlab']['geo-postgresql']['max_worker_processes'])
.to eq(8)
expect(chef_run).to render_file(runtime_conf)
.with_content(/max_worker_processes = 8/)
end
it 'sets max_parallel_workers_per_gather' do
expect(chef_run.node['gitlab']['geo-postgresql']['max_parallel_workers_per_gather'])
.to eq(0)
expect(chef_run).to render_file(runtime_conf)
.with_content(/max_parallel_workers_per_gather = 0/)
end
it 'sets log_lock_waits' do
expect(chef_run.node['gitlab']['geo-postgresql']['log_lock_waits'])
.to eq(1)
expect(chef_run).to render_file(runtime_conf)
.with_content(/log_lock_waits = 1/)
end
it 'sets deadlock_timeout' do
expect(chef_run.node['gitlab']['geo-postgresql']['deadlock_timeout'])
.to eq('5s')
expect(chef_run).to render_file(runtime_conf)
.with_content(/deadlock_timeout = '5s'/)
end
it 'sets track_io_timing' do
expect(chef_run.node['gitlab']['geo-postgresql']['track_io_timing'])
.to eq('off')
expect(chef_run).to render_file(runtime_conf)
.with_content(/track_io_timing = 'off'/)
end
end
end

View File

@ -338,6 +338,54 @@ describe 'postgresql 9.6' do
expect(chef_run).to render_file(runtime_conf)
.with_content(/idle_in_transaction_session_timeout = 60000/)
end
it 'sets effective_io_concurrency' do
expect(chef_run.node['gitlab']['postgresql']['effective_io_concurrency'])
.to eq(1)
expect(chef_run).to render_file(runtime_conf)
.with_content(/effective_io_concurrency = 1/)
end
it 'sets max_worker_processes' do
expect(chef_run.node['gitlab']['postgresql']['max_worker_processes'])
.to eq(8)
expect(chef_run).to render_file(runtime_conf)
.with_content(/max_worker_processes = 8/)
end
it 'sets max_parallel_workers_per_gather' do
expect(chef_run.node['gitlab']['postgresql']['max_parallel_workers_per_gather'])
.to eq(0)
expect(chef_run).to render_file(runtime_conf)
.with_content(/max_parallel_workers_per_gather = 0/)
end
it 'sets log_lock_waits' do
expect(chef_run.node['gitlab']['postgresql']['log_lock_waits'])
.to eq(1)
expect(chef_run).to render_file(runtime_conf)
.with_content(/log_lock_waits = 1/)
end
it 'sets deadlock_timeout' do
expect(chef_run.node['gitlab']['postgresql']['deadlock_timeout'])
.to eq('5s')
expect(chef_run).to render_file(runtime_conf)
.with_content(/deadlock_timeout = '5s'/)
end
it 'sets track_io_timing' do
expect(chef_run.node['gitlab']['postgresql']['track_io_timing'])
.to eq('off')
expect(chef_run).to render_file(runtime_conf)
.with_content(/track_io_timing = 'off'/)
end
end
it 'notifies reload postgresql when postgresql.conf changes' do