X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/05fef779d7706cd3db12d78ff82d88e6b994347c..d16a271815bbfa1c2d5f38f106db0c7af7291a52:/cookbooks/tile/templates/default/replicate.erb diff --git a/cookbooks/tile/templates/default/replicate.erb b/cookbooks/tile/templates/default/replicate.erb index 8ebfd94a5..bdd271f61 100644 --- a/cookbooks/tile/templates/default/replicate.erb +++ b/cookbooks/tile/templates/default/replicate.erb @@ -17,6 +17,11 @@ exec > /var/log/tile/replicate.log 2>&1 # Change to the replication state directory cd /var/lib/replicate +<% if @postgresql_version >= 12 -%> + +# Disable JIT and parallel workers in postgres +export PGOPTIONS="-c jit=off -c max_parallel_workers_per_gather=0" +<% end -%> # Install exit handler trap onexit EXIT @@ -47,21 +52,37 @@ do # Apply the changes to the database osm2pgsql --database gis --slim --append --number-processes=1 \ -<% if node[:tile][:node_file] -%> - --flat-nodes=<%= node[:tile][:node_file] %> \ +<% if node[:tile][:database][:node_file] -%> + --flat-nodes=<%= node[:tile][:database][:node_file] %> \ +<% end -%> +<% if node[:tile][:database][:multi_geometry] -%> + --multi-geometry \ +<% end -%> +<% if node[:tile][:database][:hstore] -%> + --hstore \ <% end -%> -<% if node[:tile][:styles][:default][:revision] >= "v4.0.0" -%> - --multi-geometry --hstore \ - --style=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.style \ - --tag-transform-script=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.lua \ +<% if node[:tile][:database][:style_file] -%> + --style=<%= node[:tile][:database][:style_file] %> \ +<% end -%> +<% if node[:tile][:database][:tag_transform_script] -%> + --tag-transform-script=<%= node[:tile][:database][:tag_transform_script] %> \ <% end -%> ${file} # No need to rollback now rm sequence-prev.txt + # Get buffer count + buffers=$(osmium fileinfo --extended --get=data.buffers.count ${file}) + + # If this diff has content mark it as the latest diff + if [ $buffers -gt 0 ] + then + ln -f ${file} changes-latest.osc.gz + fi + # Queue these changes for expiry processing - ln ${file} expire-queue/$file + ln ${file} expire-queue/${file} # Delete old downloads find . -name 'changes-*.gz' -mmin +300 -exec rm -f {} \;