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

Handle connection strings and failover? #49

Open
kevinelliott opened this issue Aug 9, 2022 · 2 comments
Open

Handle connection strings and failover? #49

kevinelliott opened this issue Aug 9, 2022 · 2 comments

Comments

@kevinelliott
Copy link

kevinelliott commented Aug 9, 2022

Does the postgres library for dart support connection strings?
Does it support multi-hosts connection strings or multi-host in general?
Can it handle reconnection to a read-write node if failover occurs (such as w/ Citus pg-auto-failover, see: https://www.citusdata.com/blog/2021/02/12/reconnecting-your-app-after-a-postgres-failover/)?

The foundational Postgres library (libpq) does support these things, and it would be good to know if this library can be augmented to support the features.

@isoos
Copy link
Owner

isoos commented Aug 9, 2022

Does the postgres library for dart support connection strings?

The related package postgres_pool does support some:
https://pub.dev/documentation/postgres_pool/latest/postgres_pool/PgEndpoint/PgEndpoint.parse.html

(they will be eventually merged)

Does it support multi-hosts connection strings or multi-host in general?

I've implemented this in another related library: cockroachdb_pool, which was very useful for a project. I guess one could use it and implement a similar thing for asymmetrical postgres/citus layouts too:
https://pub.dev/packages/cockroachdb_pool

The foundational Postgres library (libpq) does support these things, and it would be good to know if this library can be augmented to support the features.

I have plans for extending the features of the package, but in the past year or so I was really busy and couldn't find the time for it. If you are up for it, I'm happy to review and take PRs...

@kevinelliott
Copy link
Author

I see, got it, so it looks like it doesn't yet support passing the attributes, or defining multiple hosts.

I am looking at migrating to CockroachDB later, but until then I have a multi-node failover cluster and need to define the hostname of the primary active node by hand. In production this is super painful when the primary goes down.

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

No branches or pull requests

2 participants