postgresml/pgcat

default_role = "primary" doesn't behave as expected

Opened this issue · 3 comments

Describe the bug
When default_role = "primary", the requests are routed to both primary and replica nodes instead of just to the primary node.

To Reproduce

[pools.test]
pool_mode = "transaction"
default_role = "primary"
query_parser_enabled = false
query_parser_read_write_splitting = false
primary_reads_enabled = true
sharding_function = "pg_bigint_hash"

[pools.test.users.0]
username = "test"
password = "test"
pool_size = 50
statement_timeout = 0

[pools.test.shards.0]
servers = [
    [ "pg01", 5432, "primary" ],
    [ "pg02", 5432, "replica" ],
    [ "pg03", 5432, "replica" ]
]
database = "test"

Expected behavior
All requests directed to the primary replica 'pg01' .

Additional context
My goal is to route all requests to primary server, if that server is unavailable then use the replica servers.

I have the same issue.

Same issue with 3 node patroni cluster.

I have the same issue.