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

feat: force listener to work on primary cluster #3462

Merged
merged 1 commit into from
May 20, 2024

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Apr 30, 2024

Closes #3414 and closes #2781

@steve-chavez
Copy link
Member Author

steve-chavez commented May 2, 2024

New problem with our way to modify the connection string, comma separated hosts:

"postgresql://host1:123,host2:456/somedb"

Are not valid URIs for parseURI. Ref #2985


While manually testing with this format:

"postgres:///postgres?host=/dir/0kN/socket_replica_24378,/dir/0kN/socket"

Adding target_session_attrs=read-write works fine for the LISTENer though.

@steve-chavez
Copy link
Member Author

steve-chavez commented May 19, 2024

New problem on #3533, when the LISTEN fails it does so silently. That needs clearing to solve this reliably.

#3536 had to be fixed too.

working_replica_env = {
**replicaenv["replica"],
"PGRST_DB_CHANNEL_ENABLED": "false", # LISTEN doesn't work on read replicas
}

with run(env=working_replica_env) as postgrest:
with run(env=replicaenv["replica"]) as postgrest:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LISTEN now works and this test proves it

@steve-chavez steve-chavez merged commit 7e61c9d into PostgREST:main May 20, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Event triggers don't work on read replicas LISTEN/NOTIFY doesn't work on read replicas
1 participant