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

Fix default_role being ignored when query_parser_enabled was false #847

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

magec
Copy link
Collaborator

@magec magec commented Nov 5, 2024

default_role was ignored when query_parser_enabled was set to false, this was because update_pool_settings does not populate active_role field in query_router struct. The fix is simple, I just set it when the router is configured for the first time.

Note that as of this, what we say in docs:


### default_role
` ` ` 
path: pools.<pool_name>.default_role
default: "any"
` ` ` 

If the client doesn't specify, PgCat routes traffic to this role by default.
`any` round-robin between primary and replicas,
`replica` round-robin between replicas only without touching the primary,
`primary` all queries go to the primary unless otherwise specified.

is incorrect, because without the fix (and query_parser_enabled set to false), this is always treated as any (which touches the primary as well as the replicas).

@drdrsh drdrsh merged commit c9544bd into postgresml:main Nov 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants