-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
LISTEN/NOTIFY doesn't work on read replicas #2781
Comments
Now that |
Doing the above would imply having a Edit: There might be a way forward on #1766 (comment), will reopen |
This issue would be solved/avoided by #2429 since it would give us native read replica support. No need to start a postgrest for each read replica. |
Currently we silenty fail when LISTEning on a replica diogob/hasql-notifications#24, likely why we never got a report about this. |
Problem
Read replicas don’t support LISTEN/NOTIFY(ref). Thus, PostgREST NOTIFY reloading won’t work in them.
As a workaround, we can kill the pool connections:
(can be enabled conditionally with
pg_is_in_recovery()
)This will cause a schema cache reload because of Automatic Recovery.
However, the recovery won't be graceful. Two requests have to be done to start recovery.
Solution
57P01
code as a 503 to start the recovery. Only one request would fail and the second will succeed.runDbHandler
) it might possible to retry the query before getting the 503 response. We could bound the time to wait for a recover by the acquisition timeout. This way no request would fail.The text was updated successfully, but these errors were encountered: