Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf59660

Browse files
committedMay 6, 2025·
feat: handling max_slot_wal_keep_size for pg 17 was needed as well
1 parent fdcd1c4 commit cf59660

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed
 

‎ansible/files/admin_api_scripts/pg_upgrade_scripts/complete.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ function cleanup {
2222

2323
ship_logs "$LOG_FILE" || true
2424

25+
# Restore max_slot_wal_keep_size to 4096 only if both versions were PostgreSQL 17+
26+
if [[ ("$OLD_PGVERSION" =~ ^17.* || "$OLD_PGVERSION" == "17-orioledb") && ("$PGVERSION" =~ ^17.* || "$PGVERSION" == "17-orioledb") ]]; then
27+
sed -i 's/max_slot_wal_keep_size = -1/max_slot_wal_keep_size = 4096/' /etc/postgresql/postgresql.conf
28+
fi
29+
30+
# Restart postgres to apply any configuration changes
31+
if [ -z "$IS_CI" ]; then
32+
systemctl restart postgresql
33+
else
34+
CI_start_postgres
35+
fi
36+
2537
exit "$EXIT_CODE"
2638
}
2739

‎ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ function initiate_upgrade {
397397
chown -R postgres:postgres "$MOUNT_POINT/"
398398
rm -rf "${PGDATANEW:?}/"
399399

400+
# Change max_slot_wal_keep_size to -1 for upgrade only if both versions are PostgreSQL 17+
401+
if [[ ("$OLD_PGVERSION" =~ ^17.* || "$OLD_PGVERSION" == "17-orioledb") && ("$PGVERSION" =~ ^17.* || "$PGVERSION" == "17-orioledb") ]]; then
402+
sed -i 's/max_slot_wal_keep_size = [0-9]*/max_slot_wal_keep_size = -1/' /etc/postgresql/postgresql.conf
403+
fi
404+
400405
if [ "$IS_NIX_UPGRADE" = "true" ]; then
401406
if [[ "$PGVERSION" =~ ^17.* || "$PGVERSION" == "17-orioledb" ]]; then
402407
LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LANG=en_US.UTF-8 LOCALE_ARCHIVE=/usr/lib/locale/locale-archive su -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && $PGBINNEW/initdb --encoding=$SERVER_ENCODING --locale-provider=icu --icu-locale=en_US.UTF-8 -L $PGSHARENEW -D $PGDATANEW/ --username=supabase_admin" -s "$SHELL" postgres

‎ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ postgres_major:
99

1010
# Full version strings for each major version
1111
postgres_release:
12-
postgresorioledb-17: "17.0.1.078-orioledb-upgrade-3"
13-
postgres17: "17.4.1.028-upgrade-3"
14-
postgres15: "15.8.1.085-upgrade-3"
12+
postgresorioledb-17: "17.0.1.078-orioledb-upgrade-4"
13+
postgres17: "17.4.1.028-upgrade-4"
14+
postgres15: "15.8.1.085-upgrade-4"
1515

1616
# Non Postgres Extensions
1717
pgbouncer_release: "1.19.0"

0 commit comments

Comments
 (0)
Please sign in to comment.