vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.27k stars 340 forks source link

Upgrade: Fix: Apply timeout directly to psql in PgBouncer pause script #600

Closed vitabaks closed 1 month ago

vitabaks commented 1 month ago

Problem: The PgBouncer pause script was hanging indefinitely on highly loaded database servers (more than 20,000 inserts per second) because the 'timeout' command was applied to the 'ssh' session, which includes the 'psql' command execution. In cases where the database server was under heavy load, the 'PAUSE' command could not complete within the expected time frame, causing the entire script to hang.

Solution: Modified the script to apply the 'timeout' command directly to the 'psql' command. This ensures that if the 'psql' command does not complete within a 2-second timeout, it will be forcibly terminated, preventing the script from hanging.

Additionally