diff --git a/Dockerfile-17 b/Dockerfile-17 index b79dd3787c..755d9e4bea 100644 --- a/Dockerfile-17 +++ b/Dockerfile-17 @@ -152,6 +152,7 @@ RUN sed -i \ # Remove timescaledb and plv8 references (not in pg17) RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf" && \ sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf" && \ + sed -i 's/^#summarize_wal = off/summarize_wal = on/' "/etc/postgresql/postgresql.conf" && \ sed -i 's/ timescaledb,//g; s/ plv8,//g' "/etc/postgresql-custom/supautils.conf" # Include schema migrations diff --git a/Dockerfile-orioledb-17 b/Dockerfile-orioledb-17 index baf24e0ed3..407470816a 100644 --- a/Dockerfile-orioledb-17 +++ b/Dockerfile-orioledb-17 @@ -152,6 +152,7 @@ RUN sed -i \ # Remove timescaledb, plv8, postgis, pgrouting references (not available in orioledb build) RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf" && \ sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf" && \ + sed -i 's/^#summarize_wal = off/summarize_wal = on/' "/etc/postgresql/postgresql.conf" && \ sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf" # OrioleDB configuration diff --git a/ansible/files/postgresql_config/postgresql.conf.j2 b/ansible/files/postgresql_config/postgresql.conf.j2 index 37e50623e0..ce37c8d9e7 100644 --- a/ansible/files/postgresql_config/postgresql.conf.j2 +++ b/ansible/files/postgresql_config/postgresql.conf.j2 @@ -230,6 +230,8 @@ output_plugin_libraries = 'pgoutput, test_decoding, wal2json' # allowlist of log #wal_writer_delay = 200ms # 1-10000 milliseconds #wal_writer_flush_after = 1MB # measured in pages, 0 disables #wal_skip_threshold = 2MB +#summarize_wal = off # PG17+ only; enabled at build time 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/stage2-setup-postgres.yml b/ansible/tasks/stage2-setup-postgres.yml index 9c75e81dc7..367cb6f68e 100644 --- a/ansible/tasks/stage2-setup-postgres.yml +++ b/ansible/tasks/stage2-setup-postgres.yml @@ -26,6 +26,12 @@ regexp: 'db_user_namespace\ =\ off' replace: '#db_user_namespace\ =\ off' + - name: Enable summarize_wal in postgresql.conf if orioledb-17 or 17 build + ansible.builtin.replace: + path: '/etc/postgresql/postgresql.conf' + regexp: '^#summarize_wal = off' + replace: 'summarize_wal = on' + - name: Execute things when is_psql_oriole and stage2 when: stage2 and is_psql_oriole become: true 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/expected/z_orioledb-17_wal_summarize.out b/nix/tests/expected/z_orioledb-17_wal_summarize.out new file mode 100644 index 0000000000..80faf63270 --- /dev/null +++ b/nix/tests/expected/z_orioledb-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/tests/sql/z_orioledb-17_wal_summarize.sql b/nix/tests/sql/z_orioledb-17_wal_summarize.sql new file mode 100644 index 0000000000..eec068e11e --- /dev/null +++ b/nix/tests/sql/z_orioledb-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 041304abd8..a38565d295 100644 --- a/nix/tools/run-server.sh.in +++ b/nix/tools/run-server.sh.in @@ -247,6 +247,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 = off/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