From 7f5b19817eaf38e70ad1153db4e644ee9456853e Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Wed, 29 Mar 2023 21:53:38 +0200 Subject: Support connection load balancing in libpq This adds support for load balancing connections with libpq using a connection parameter: load_balance_hosts=. When setting the param to random, hosts and addresses will be connected to in random order. This then results in load balancing across these addresses and hosts when multiple clients or frequent connection setups are used. The randomization employed performs two levels of shuffling: 1. The given hosts are randomly shuffled, before resolving them one-by-one. 2. Once a host its addresses get resolved, the returned addresses are shuffled, before trying to connect to them one-by-one. Author: Jelte Fennema Reviewed-by: Aleksander Alekseev Reviewed-by: Michael Banck Reviewed-by: Andrey Borodin Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook. --- src/test/perl/PostgreSQL/Test/Cluster.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/test/perl') diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 3e2a27fb717..a3aef8b5e91 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -2567,6 +2567,22 @@ sub issues_sql_like return; } +=pod + +=item $node->log_content() + +Returns the contents of log of the node + +=cut + +sub log_content +{ + my ($self) = @_; + return + PostgreSQL::Test::Utils::slurp_file($self->logfile); +} + + =pod =item $node->run_log(...) -- cgit v1.2.3