postgresml / pgcat

PostgreSQL pooler with sharding, load balancing and failover support.
MIT License
3.13k stars 193 forks source link

Implemented PGBouncer like database Proxy functionality using Auth_Query #855

Open rvsoni opened 2 weeks ago

rvsoni commented 2 weeks ago

Implemented PGBouncer like database Proxy functionality using Auth_Query

The new implementation behavior is as follows, For any pool, if proxy configuration is made true, the pool would not initialize on the pgcat startup, on the first connection, pgcat would connect to the PostgreSQL cluster using auth_query and retrieve a password hash and established pool on the fly,

This implementation fixes the following issues.

443, #509

Following PR #521, #631 should marge to enhance this implementation,

Use pgcat.proxy.toml as a configuration sample.

Added new configuration proxy variable per pool to indicate this is pgbouncer like proxy behaviour and would use auth_query base login.

I am doing Rust programming for the first time, so I see many code improvements in this implementation. Also, I have made a lot of duplicate code to implement this functionality.

Please review the code and suggest any changes to make this PR ready to merge.

Feel free to ask any questions on this implementation.