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

Read-only endpoints problem #214

Open
Zvirovyi opened this issue Apr 16, 2024 · 4 comments
Open

Read-only endpoints problem #214

Zvirovyi opened this issue Apr 16, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Zvirovyi
Copy link

Hi! I've discovered some weird behavior with read-only-endpoints.

Steps to reproduce

Model:

image
  1. Pgbouncer always includes read-only channel in its config upon different database name (main database name + _readonly suffix) if there are postgresql replicas. (example below is on data-integrator/1)

    [databases]
    
    asd = host=10.88.216.205 dbname=asd port=5432 auth_user=pgbouncer_auth_relation_7
    
    asd_readonly = host=10.88.216.56,10.88.216.129 dbname=asd port=5432 auth_user=pgbouncer_auth_relation_7
    
  2. But pgbouncer does not notify client application about read-only-endpoints if it's not exposed (external-node-connectivity).

    image
  3. And even when it exposed, it notifies client application with read-only-endpoints pointing to each non-leader pgbouncer unit IP.

    image

Expected behavior

Pgbouncer always must provide application with both RW and read-only channels if there are postgresql replicas active. And, i assume, there is need to move read-only channel to different endpoint, because postgresql_client/v0 assumes that database name will be the same and only endpoint is different.

Actual behavior

When not exposed, pgbouncer will ignore read-only channel, so that application just can't use postgresql replicas.
And when exposed, app will put all the non-leader pgbouncer unit IPs into read-only-endpoints (but it has nothing to do with read-only channels to postgresql replicas, it just another pgbouncer units pointing to the same primary).

Versions

Operating system: Ubuntu 23.10

Juju CLI: 3.4.2-genericlinux-amd64

Juju agent: 3.4.0

postgresql charm revision: edge (rev. 393)
pgbouncer charm revision: 1/edge (rev. 142)

LXD: 5.21.1 LTS

@Zvirovyi Zvirovyi added the bug Something isn't working label Apr 16, 2024
Copy link
Contributor

@taurus-forever
Copy link
Contributor

@dragomirp can you please comment it here. IMHO, we should notify client on the endpoints change... always. Is the UNIX SOCKET pgb concept affects us here?

@taurus-forever
Copy link
Contributor

BTW, on the reported image the pgboucer/1 exposed port, but pgbouncer/2 didn't. why?

@dragomirp
Copy link
Contributor

@dragomirp can you please comment it here. IMHO, we should notify client on the endpoints change... always. Is the UNIX SOCKET pgb concept affects us here?

When there's no external node connectivity, client units are only supposed to use the local subordinated pgbouncer. There's no place to set a read only database name in the interface and, as is, accessing those requires the client charm to be aware of the _readonly databases. To be able to have meaningful read only endpoints, we'll need to add another PGB read only instance serving on a different port, since that can be different in the interface.

With data integrator we'd have the inverse problem, if we provide real readonly endpoint (on a different port), there would be no way to get all available RW endpoints without that the client has to switch ports.

This is preexisting behaviour, since before the charm was made subordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants