From aa28d990fd2ea86e9a2a5351e30685e3c037c8bc Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Wed, 26 Aug 2026 21:14:30 +0600 Subject: [PATCH] Include pgtune.conf in remote replica postgresql.conf The tuning include (include_if_exists for pgtune.conf, gated on TUNING_ENABLED) was already emitted by primary/start.sh and standby/run.sh, but remote-replica.sh builds its own /tmp/postgresql.conf and never included it. As a result remote replica pods ignored the tuned configuration entirely. Add the same block right after the config file is created in role_scripts/{13..18}/standby/remote-replica.sh, matching the placement used by the primary and standby scripts so explicit settings written later still take precedence. Signed-off-by: souravbiswassanto --- role_scripts/13/standby/remote-replica.sh | 5 +++++ role_scripts/14/standby/remote-replica.sh | 5 +++++ role_scripts/15/standby/remote-replica.sh | 5 +++++ role_scripts/16/standby/remote-replica.sh | 5 +++++ role_scripts/17/standby/remote-replica.sh | 5 +++++ role_scripts/18/standby/remote-replica.sh | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/role_scripts/13/standby/remote-replica.sh b/role_scripts/13/standby/remote-replica.sh index 93c522e..5a46fdb 100755 --- a/role_scripts/13/standby/remote-replica.sh +++ b/role_scripts/13/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS diff --git a/role_scripts/14/standby/remote-replica.sh b/role_scripts/14/standby/remote-replica.sh index 8841aec..cd68217 100755 --- a/role_scripts/14/standby/remote-replica.sh +++ b/role_scripts/14/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS diff --git a/role_scripts/15/standby/remote-replica.sh b/role_scripts/15/standby/remote-replica.sh index 8841aec..cd68217 100755 --- a/role_scripts/15/standby/remote-replica.sh +++ b/role_scripts/15/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS diff --git a/role_scripts/16/standby/remote-replica.sh b/role_scripts/16/standby/remote-replica.sh index 4ee0698..b1dacdf 100755 --- a/role_scripts/16/standby/remote-replica.sh +++ b/role_scripts/16/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS diff --git a/role_scripts/17/standby/remote-replica.sh b/role_scripts/17/standby/remote-replica.sh index 514fc6b..c9d00cd 100755 --- a/role_scripts/17/standby/remote-replica.sh +++ b/role_scripts/17/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS diff --git a/role_scripts/18/standby/remote-replica.sh b/role_scripts/18/standby/remote-replica.sh index 514fc6b..c9d00cd 100755 --- a/role_scripts/18/standby/remote-replica.sh +++ b/role_scripts/18/standby/remote-replica.sh @@ -82,6 +82,11 @@ fi # setup postgresql.conf touch /tmp/postgresql.conf + +if [[ "${TUNING_ENABLED:-}" == "true" ]]; then + echo "include_if_exists = '${TUNING_FILE_PATH:-/etc/config/pgtune.conf}'" >>/tmp/postgresql.conf +fi + echo "wal_level = replica" >>/tmp/postgresql.conf echo "shared_buffers = $SHARED_BUFFERS" >>/tmp/postgresql.conf echo "max_wal_senders = 90" >>/tmp/postgresql.conf # default is 10. value must be less than max_connections minus superuser_reserved_connections. ref: https://www.postgresql.org/docs/11/runtime-config-replication.html#GUC-MAX-WAL-SENDERS