Skip to content

fix: restart PG during pre-upgrade steps to shed hanging connections #1271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ swap_postgres_and_supabase_admin() {
alter database postgres connection limit 0;
select pg_terminate_backend(pid) from pg_stat_activity where backend_type = 'client backend' and pid != pg_backend_pid();
EOSQL

if [ -z "$IS_CI" ]; then
retry 5 systemctl restart postgresql
else
CI_start_postgres ""
fi

retry 8 pg_isready -h localhost -U supabase_admin

run_sql <<'EOSQL'
set statement_timeout = '600s';
begin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ cleanup() {
}

function handle_extensions {
if [ -z "$IS_CI" ]; then
retry 5 systemctl restart postgresql
else
CI_start_postgres
fi

retry 8 pg_isready -h localhost -U supabase_admin

rm -f $POST_UPGRADE_EXTENSION_SCRIPT
touch $POST_UPGRADE_EXTENSION_SCRIPT

Expand Down
Loading