File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
ansible/files/admin_api_scripts/pg_upgrade_scripts Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ MOUNT_POINT="/data_migration"
39
39
LOG_FILE=" /var/log/pg-upgrade-initiate.log"
40
40
41
41
POST_UPGRADE_EXTENSION_SCRIPT=" /tmp/pg_upgrade/pg_upgrade_extensions.sql"
42
+ POST_UPGRADE_PGBOUNCER_CLEANUP_SCRIPT=" /tmp/pg_upgrade/pg_upgrade_pgbouncer_cleanup.sql"
42
43
OLD_PGVERSION=$( run_sql -A -t -c " SHOW server_version;" )
43
44
44
45
SERVER_LC_COLLATE=$( run_sql -A -t -c " SHOW lc_collate;" )
@@ -132,6 +133,22 @@ cleanup() {
132
133
echo " Resetting postgres database connection limit"
133
134
retry 5 run_sql -c " ALTER DATABASE postgres CONNECTION LIMIT -1;"
134
135
136
+ echo " Making sure postgres still has access to pg_shadow"
137
+ cat << EOF >> $POST_UPGRADE_PGBOUNCER_CLEANUP_SCRIPT
138
+ DO \$\$
139
+ BEGIN
140
+ IF EXISTS (SELECT 1 FROM pg_views WHERE viewname = 'pg_shadow' AND viewowner = 'supabase_admin') THEN
141
+ ALTER function pgbouncer.get_auth owner to supabase_admin;
142
+ GRANT EXECUTE ON FUNCTION pgbouncer.get_auth(p_usename TEXT) TO postgres;
143
+ END IF;
144
+ END;
145
+ \$\$ ;
146
+ EOF
147
+
148
+ if [ -f $POST_UPGRADE_PGBOUNCER_CLEANUP_SCRIPT ]; then
149
+ retry 5 run_sql -f $POST_UPGRADE_PGBOUNCER_CLEANUP_SCRIPT
150
+ fi
151
+
135
152
if [ -z " $IS_CI " ] && [ -z " $IS_LOCAL_UPGRADE " ]; then
136
153
echo " Unmounting data disk from ${MOUNT_POINT} "
137
154
retry 3 umount $MOUNT_POINT
You can’t perform that action at this time.
0 commit comments