hapostgres / hapostgres/pg_auto_failover

In an HA environment commands are misdirected during switchover

Open
#575 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
142
Avg merge
5h 8m
Merged PRs (30d)
1

Description

We want to build a HA setup, using PG-Autofailover as the monitor & and employ multi-host connection strings to connect to the primary (writable) database from the client.
Now we find that during failover the sql commands get directed to the wrong server.
`connstr="postgres://localhost:5433,localhost:5434/postgres?target_session_attrs=read-write&sslmode=require"`
`It appears that during fail-over the command show transaction_read_only returns nothing for a while. According to the docs the "libq" process looks for a result of "on" to detect & ignore/close the read-only connection. So when it gets an empty reply it mistakes it for the writable node. The result depends on whether the primary is the first or second entry in the connection string. Any suggestions for a work-around?
Script to show problem:
[show_fo_demo.sh.gz](https://github.com/citusdata/pg_auto_failover/files/5891101/show_fo_demo.sh.gz)
Output:
[show_fo_demo.log.gz](https://github.com/citusdata/pg_auto_failover/files/5891104/show_fo_demo.log.gz)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.