Skip to content

Commit 5a04a88

Browse files
committed
fix(pg_upgrade): do not restart PG if replication slots are present
1 parent ca89fbd commit 5a04a88

File tree

1 file changed

+5
-1
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+5
-1
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,11 @@ EOF
467467
# Extra work to ensure postgres is actually stopped
468468
# Mostly needed for PG12 projects with odd systemd unit behavior
469469
if [ -z "$IS_CI" ]; then
470-
retry 5 systemctl restart postgresql
470+
REPLICATION_SLOT_COUNT=$(run_sql -A -t -c "SELECT COUNT(*) FROM pg_replication_slots;")
471+
if [[ "$REPLICATION_SLOT_COUNT" -eq 0 ]]; then
472+
echo "No replication slots found; restarting postgres"
473+
retry 5 systemctl restart postgresql
474+
fi
471475
systemctl disable postgresql
472476
retry 5 systemctl stop postgresql
473477

0 commit comments

Comments
 (0)