diff --git a/Dockerfile-15 b/Dockerfile-15 index 2bd2038fe5..6e0e08993f 100644 --- a/Dockerfile-15 +++ b/Dockerfile-15 @@ -144,7 +144,8 @@ RUN sed -i \ -e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \ -e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \ -e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \ - -e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \ + -e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" \ + -e "s|^summarize_wal = on|#&|g" /etc/postgresql/postgresql.conf && \ echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \ chown -R postgres:postgres /etc/postgresql-custom diff --git a/ansible/files/postgresql_config/postgresql.conf.j2 b/ansible/files/postgresql_config/postgresql.conf.j2 index 154ec13416..9219c14fd0 100644 --- a/ansible/files/postgresql_config/postgresql.conf.j2 +++ b/ansible/files/postgresql_config/postgresql.conf.j2 @@ -227,7 +227,8 @@ wal_level = logical # minimal, replica, or logical #wal_writer_delay = 200ms # 1-10000 milliseconds #wal_writer_flush_after = 1MB # measured in pages, 0 disables #wal_skip_threshold = 2MB - +summarize_wal = on # run WAL summarizer for 17 and up +#wal_summary_keep_time = '10d' # when to remove old summary files; 0 = never #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 diff --git a/ansible/tasks/setup-postgres.yml b/ansible/tasks/setup-postgres.yml index 1bcc0420e4..a630159672 100644 --- a/ansible/tasks/setup-postgres.yml +++ b/ansible/tasks/setup-postgres.yml @@ -94,6 +94,13 @@ loop_control: loop_var: 'pg_config_item' + - name: Disable summarize_wal on PG15 (GUC only exists from PG17) + when: psql_version == 'psql_15' + ansible.builtin.replace: + path: '/etc/postgresql/postgresql.conf' + regexp: '^summarize_wal = on' + replace: '#summarize_wal = on' + - name: Set data_directory to canonical path on data volume ansible.builtin.lineinfile: path: '/etc/postgresql/postgresql.conf' diff --git a/nix/checks.nix b/nix/checks.nix index 518aac5690..818342e19e 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -368,6 +368,7 @@ echo "port = ${pgPort}" echo "session_preload_libraries = 'supautils'" echo "dynamic_library_path = '${supautils}/lib:\$libdir'" + ${lib.optionalString (pgpkg.version != "15") ''echo "summarize_wal = on"''} } >> "$PGTAP_CLUSTER"/postgresql.conf echo "host all all 127.0.0.1/32 trust" >> "$PGTAP_CLUSTER/pg_hba.conf" log info "Checking shared_preload_libraries setting:" diff --git a/nix/tests/expected/z_17_wal_summarize.out b/nix/tests/expected/z_17_wal_summarize.out new file mode 100644 index 0000000000..80faf63270 --- /dev/null +++ b/nix/tests/expected/z_17_wal_summarize.out @@ -0,0 +1,6 @@ +SELECT (SELECT setting FROM pg_settings WHERE name = 'summarize_wal') = 'on' AS summarize_wal_default_ok; + summarize_wal_default_ok +-------------------------- + t +(1 row) + diff --git a/nix/tests/sql/z_17_wal_summarize.sql b/nix/tests/sql/z_17_wal_summarize.sql new file mode 100644 index 0000000000..eec068e11e --- /dev/null +++ b/nix/tests/sql/z_17_wal_summarize.sql @@ -0,0 +1 @@ +SELECT (SELECT setting FROM pg_settings WHERE name = 'summarize_wal') = 'on' AS summarize_wal_default_ok; diff --git a/nix/tools/run-server.sh.in b/nix/tools/run-server.sh.in index 6090cab8f0..bc1ca6900c 100644 --- a/nix/tools/run-server.sh.in +++ b/nix/tools/run-server.sh.in @@ -246,6 +246,11 @@ session_preload_libraries = 'supautils'" \ -e "s|include_dir = '/etc/postgresql-custom/conf.d'|include_dir = '$DATDIR/conf.d'|" \ "$PSQL_CONF_FILE" > "$DATDIR/postgresql.conf" +# summarize_wal is PostgreSQL 17+; PG15 refuses to start on an unknown GUC +if [ "$VERSION" == "15" ]; then + perl -pi -e 's/^summarize_wal = on/#$&/' "$DATDIR/postgresql.conf" +fi + # Function to configure OrioleDB specific settings orioledb_config_items() { if [[ "$1" = "orioledb-17" && "$CURRENT_SYSTEM" != "aarch64-darwin" ]]; then