Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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