Skip to content
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

chore: disable pg_net processing before running upgrades #1036

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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 @@ -128,6 +128,14 @@ function handle_extensions {
echo "ALTER SYSTEM SET password_encryption = 'md5';" >> $POST_UPGRADE_EXTENSION_SCRIPT
fi

# Persisting pg_net.batch_size setting if it exists, setting it to the default of 200 if it doesn't
PG_NET_BATCH_SIZE_SETTING=$(run_sql -A -t -c "SELECT COALESCE( (SELECT setting from pg_settings where name = 'pg_net.batch_size'), '200')")
echo "ALTER SYSTEM SET pg_net.batch_size = $PG_NET_BATCH_SIZE_SETTING;" >> $POST_UPGRADE_EXTENSION_SCRIPT

# Setting batch_size to zero to disable pg_net requests during upgrade; restarting pg_net worker processes to make setting active
run_sql -c "ALTER SYSTEM SET pg_net.batch_size = 0;"
run_sql -c "SELECT pg_reload_conf(); SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE backend_type ILIKE '%pg_net%';"

cat << EOF >> $POST_UPGRADE_EXTENSION_SCRIPT
ALTER SYSTEM SET jit = off;
SELECT pg_reload_conf();
Expand Down
Loading