From c389f176ac7a568bedaa7bdd690438b72ecf35bf Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 24 Jan 2023 21:22:54 +0000 Subject: [PATCH] Drop support for old versions of postgres --- cookbooks/postgresql/attributes/default.rb | 1 - cookbooks/postgresql/recipes/default.rb | 24 +------------------ .../templates/default/postgresql.conf.erb | 17 ------------- roles/db.rb | 1 - roles/nominatim.rb | 1 - roles/tile.rb | 1 - 6 files changed, 1 insertion(+), 44 deletions(-) diff --git a/cookbooks/postgresql/attributes/default.rb b/cookbooks/postgresql/attributes/default.rb index 568e53b57..419b44de8 100644 --- a/cookbooks/postgresql/attributes/default.rb +++ b/cookbooks/postgresql/attributes/default.rb @@ -19,7 +19,6 @@ default[:postgresql][:settings][:defaults][:synchronous_commit] = "on" default[:postgresql][:settings][:defaults][:wal_buffers] = "-1" 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" diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index affe9f502..a3ef7d23d 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -35,7 +35,6 @@ node[:postgresql][:versions].each do |version| standby_mode = settings[:standby_mode] || defaults[:standby_mode] primary_conninfo = settings[:primary_conninfo] || defaults[:primary_conninfo] - restore_command = settings[:restore_command] || defaults[:restore_command] passwords = if primary_conninfo data_bag_item(primary_conninfo[:passwords][:bag], @@ -87,28 +86,7 @@ node[:postgresql][:versions].each do |version| only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") } end - if version.to_f < 12 && (restore_command || standby_mode == "on") - template "/var/lib/postgresql/#{version}/main/recovery.conf" do - source "recovery.conf.erb" - owner "postgres" - group "postgres" - mode "640" - variables :standby_mode => standby_mode, - :primary_conninfo => primary_conninfo, - :restore_command => restore_command, - :passwords => passwords - notifies :reload, "service[postgresql]" - only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") } - end - else - template "/var/lib/postgresql/#{version}/main/recovery.conf" do - action :delete - notifies :reload, "service[postgresql]" - only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") } - end - end - - if version.to_f > 11 && standby_mode == "on" + if standby_mode == "on" file "/var/lib/postgresql/#{version}/main/standby.signal" do owner "postgres" group "postgres" diff --git a/cookbooks/postgresql/templates/default/postgresql.conf.erb b/cookbooks/postgresql/templates/default/postgresql.conf.erb index 55053f5f8..855e8dc6c 100644 --- a/cookbooks/postgresql/templates/default/postgresql.conf.erb +++ b/cookbooks/postgresql/templates/default/postgresql.conf.erb @@ -20,11 +20,7 @@ listen_addresses = '<%= @settings[:listen_addresses] || @defaults[:listen_addres <% end -%> port = <%= @settings[:port] || @defaults[:port] %> max_connections = <%= @settings[:max_connections] || @defaults[:max_connections] %> -<% if @version.to_f >= 9.3 %> unix_socket_directories = '/var/run/postgresql' -<% else -%> -unix_socket_directory = '/var/run/postgresql' -<% end -%> # - Security and Authentication - @@ -47,12 +43,8 @@ max_stack_depth = <%= @settings[:max_stack_depth] || @defaults[:max_stack_depth] effective_io_concurrency = <%= @settings[:effective_io_concurrency] || @defaults[:effective_io_concurrency] %> max_worker_processes = <%= @settings[:max_worker_processes] || @defaults[:max_worker_processes] %> -<% if @version.to_f >= 9.6 -%> max_parallel_workers_per_gather = <%= @settings[:max_parallel_workers_per_gather] || @defaults[:max_parallel_workers_per_gather] %> -<% end -%> -<% if @version.to_f >= 10 -%> max_parallel_workers = <%= @settings[:max_parallel_workers] || @defaults[:max_parallel_workers] %> -<% end -%> #------------------------------------------------------------------------------ # WRITE AHEAD LOG @@ -69,14 +61,9 @@ commit_delay = <%= @settings[:commit_delay] || @defaults[:commit_delay] %> # - Checkpoints - -<% 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 - @@ -101,9 +88,7 @@ restore_command = '<%= @settings[:restore_command] || @defaults[:restore_command # - Sending Server(s) - max_wal_senders = <%= @settings[:max_wal_senders] || @defaults[:max_wal_senders] %> -<% if @version.to_f >= 9.4 -%> max_replication_slots = <%= @settings[:max_replication_slots] || @defaults[:max_replication_slots] %> -<% end -%> # - Standby Servers - @@ -126,9 +111,7 @@ effective_cache_size = <%= @settings[:effective_cache_size] || @defaults[:effect # - Other Planner Options - default_statistics_target = <%= @settings[:default_statistics_target] || @defaults[:default_statistics_target] %> -<% if @version.to_f >= 12 -%> jit = <%= @settings[:jit] || @defaults[:jit] %> -<% end -%> #------------------------------------------------------------------------------ # REPORTING AND LOGGING diff --git a/roles/db.rb b/roles/db.rb index 81aed8678..b45aab91c 100644 --- a/roles/db.rb +++ b/roles/db.rb @@ -42,7 +42,6 @@ default_attributes( :max_connections => "1500", :max_stack_depth => "7MB", :wal_level => "logical", - :checkpoint_segments => "32", :max_wal_size => "1536MB", :checkpoint_completion_target => "0.8", :max_wal_senders => "10", diff --git a/roles/nominatim.rb b/roles/nominatim.rb index fd8295429..36811a801 100644 --- a/roles/nominatim.rb +++ b/roles/nominatim.rb @@ -21,7 +21,6 @@ default_attributes( :defaults => { :max_connections => "450", :synchronous_commit => "off", - :checkpoint_segments => "32", :checkpoint_timeout => "10min", :checkpoint_completion_target => "0.9", :jit => "off", diff --git a/roles/tile.rb b/roles/tile.rb index a30962415..be27fe163 100644 --- a/roles/tile.rb +++ b/roles/tile.rb @@ -43,7 +43,6 @@ default_attributes( :wal_buffers => "1024kB", :wal_writer_delay => "500ms", :commit_delay => "10000", - :checkpoint_segments => "60", :max_wal_size => "2880MB", :random_page_cost => "1.1", :jit => "off", -- 2.39.5