From 846b489e99b9e5237dd230d19da419be88635677 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 15 Aug 2016 19:28:50 +0100 Subject: [PATCH] Add max_wal_size support for postgresql 9.5 --- cookbooks/postgresql/attributes/default.rb | 2 ++ cookbooks/postgresql/templates/default/postgresql.conf.erb | 6 +++++- roles/db.rb | 1 + roles/nominatim.rb | 1 + roles/owl.rb | 1 + roles/tile.rb | 3 ++- 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cookbooks/postgresql/attributes/default.rb b/cookbooks/postgresql/attributes/default.rb index bb6b0fd88..42939d7cd 100644 --- a/cookbooks/postgresql/attributes/default.rb +++ b/cookbooks/postgresql/attributes/default.rb @@ -15,6 +15,8 @@ default[:postgresql][:settings][:defaults][:wal_writer_delay] = "200ms" default[:postgresql][:settings][:defaults][:commit_delay] = "0" default[:postgresql][:settings][:defaults][:checkpoint_segments] = "3" default[:postgresql][:settings][:defaults][:checkpoint_timeout] = "5min" +default[:postgresql][:settings][:defaults][:max_wal_size] = "1GB" +default[:postgresql][:settings][:defaults][:min_wal_size] = "80MB" default[:postgresql][:settings][:defaults][:checkpoint_completion_target] = "0.5" default[:postgresql][:settings][:defaults][:archive_mode] = "off" default[:postgresql][:settings][:defaults][:max_wal_senders] = "0" diff --git a/cookbooks/postgresql/templates/default/postgresql.conf.erb b/cookbooks/postgresql/templates/default/postgresql.conf.erb index 754131e73..850fc1b3c 100644 --- a/cookbooks/postgresql/templates/default/postgresql.conf.erb +++ b/cookbooks/postgresql/templates/default/postgresql.conf.erb @@ -58,10 +58,14 @@ commit_delay = <%= @settings[:commit_delay] || @defaults[:commit_delay] %> # - Checkpoints - -<% if @version.to_f < 9.5 %> +<% if @version.to_f < 9.5 -%> checkpoint_segments = <%= @settings[:checkpoint_segments] || @defaults[:checkpoint_segments] %> <% end -%> checkpoint_timeout = <%= @settings[:checkpoint_timeout] || @defaults[:checkpoint_timeout] %> +<% if @version.to_f >= 9.5 -%> +max_wal_size = <%= @settings[:max_wal_size] || @defaults[:max_wal_size] %> +min_wal_size = <%= @settings[:min_wal_size] || @defaults[:min_wal_size] %> +<% end -%> checkpoint_completion_target = <%= @settings[:checkpoint_completion_target] || @defaults[:checkpoint_completion_target] %> # - Archiving - diff --git a/roles/db.rb b/roles/db.rb index df79f702e..aa8679ddf 100644 --- a/roles/db.rb +++ b/roles/db.rb @@ -46,6 +46,7 @@ default_attributes( :max_connections => "600", :max_stack_depth => "7MB", :checkpoint_segments => "32", + :max_wal_size => "1536MB", :checkpoint_completion_target => "0.8", :cpu_tuple_cost => "0.1", :late_authentication_rules => [ diff --git a/roles/nominatim.rb b/roles/nominatim.rb index 041cd0e13..81fc388be 100644 --- a/roles/nominatim.rb +++ b/roles/nominatim.rb @@ -29,6 +29,7 @@ default_attributes( :synchronous_commit => "off", :checkpoint_segments => "32", :checkpoint_timeout => "10min", + :max_wal_size => "1536MB", :checkpoint_completion_target => "0.9", :shared_buffers => "2GB", :autovacuum_max_workers => "1" diff --git a/roles/owl.rb b/roles/owl.rb index 44f44c62f..08d7b2f87 100644 --- a/roles/owl.rb +++ b/roles/owl.rb @@ -29,6 +29,7 @@ default_attributes( :defaults => { :fsync => "off", :checkpoint_segments => "30", + :max_wal_size => "1440MB", :checkpoint_completion_target => "0.9", :random_page_cost => "2.0", :log_min_duration_statement => "3000" diff --git a/roles/tile.rb b/roles/tile.rb index 9849fed4b..433805feb 100644 --- a/roles/tile.rb +++ b/roles/tile.rb @@ -30,7 +30,8 @@ default_attributes( :wal_buffers => "1024kB", :wal_writer_delay => "500ms", :commit_delay => "10000", - :checkpoint_segments => "60" + :checkpoint_segments => "60", + :max_wal_size => "2880MB" } } }, -- 2.39.5