From 5e7d9bac10f4d332e5a37a20371c38f3fd27e42b Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:26:15 +0300 Subject: [PATCH 1/3] feat: enable summarize_wal for all 17 and up servers --- ansible/files/postgresql_config/postgresql.conf.j2 | 6 ++++++ ansible/tasks/setup-postgres.yml | 7 +++++++ nix/tests/expected/z_17_wal_summarize.out | 5 +++++ nix/tests/sql/z_17_wal_summarize.sql | 1 + nix/tools/run-server.sh.in | 5 +++++ 5 files changed, 24 insertions(+) create mode 100644 nix/tests/expected/z_17_wal_summarize.out create mode 100644 nix/tests/sql/z_17_wal_summarize.sql diff --git a/ansible/files/postgresql_config/postgresql.conf.j2 b/ansible/files/postgresql_config/postgresql.conf.j2 index 154ec13416..8e1981b38e 100644 --- a/ansible/files/postgresql_config/postgresql.conf.j2 +++ b/ansible/files/postgresql_config/postgresql.conf.j2 @@ -250,6 +250,12 @@ checkpoint_flush_after = 256kB # measured in pages, 0 disables #archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables +# - WAL Summarization - + +# PostgreSQL 17+ +summarize_wal = on # run WAL summarizer process? +#wal_summary_keep_time = '10d' # when to remove old summary files; 0 = never + # - Archive Recovery - # These are only used in recovery mode. 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/tests/expected/z_17_wal_summarize.out b/nix/tests/expected/z_17_wal_summarize.out new file mode 100644 index 0000000000..6c60eef360 --- /dev/null +++ b/nix/tests/expected/z_17_wal_summarize.out @@ -0,0 +1,5 @@ +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..25507250d4 --- /dev/null +++ b/nix/tests/sql/z_17_wal_summarize.sql @@ -0,0 +1 @@ +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 From 89e8b21362912da753b1416cfde5488437efdedb Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:27:13 +0300 Subject: [PATCH 2/3] feat: add tests on 17 to ensure it is enabled --- ansible/files/postgresql_config/postgresql.conf.j2 | 9 ++------- nix/checks.nix | 1 + nix/tests/expected/z_17_wal_summarize.out | 5 +++-- nix/tests/sql/z_17_wal_summarize.sql | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ansible/files/postgresql_config/postgresql.conf.j2 b/ansible/files/postgresql_config/postgresql.conf.j2 index 8e1981b38e..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 @@ -250,12 +251,6 @@ checkpoint_flush_after = 256kB # measured in pages, 0 disables #archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables -# - WAL Summarization - - -# PostgreSQL 17+ -summarize_wal = on # run WAL summarizer process? -#wal_summary_keep_time = '10d' # when to remove old summary files; 0 = never - # - Archive Recovery - # These are only used in recovery mode. 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 index 6c60eef360..80faf63270 100644 --- a/nix/tests/expected/z_17_wal_summarize.out +++ b/nix/tests/expected/z_17_wal_summarize.out @@ -1,5 +1,6 @@ -SELECT setting FROM pg_settings WHERE name = 'summarize_wal') = 'on' AS summarize_wal_default_ok; - summarize_wal_default_ok +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 index 25507250d4..eec068e11e 100644 --- a/nix/tests/sql/z_17_wal_summarize.sql +++ b/nix/tests/sql/z_17_wal_summarize.sql @@ -1 +1 @@ -SELECT setting FROM pg_settings WHERE name = 'summarize_wal') = 'on' AS summarize_wal_default_ok; +SELECT (SELECT setting FROM pg_settings WHERE name = 'summarize_wal') = 'on' AS summarize_wal_default_ok; From e34d6067161daa7df96d14e16b166fbee237baa3 Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:29:58 +0300 Subject: [PATCH 3/3] remove summarize_wal from 15 config --- Dockerfile-15 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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