From a1acdacada4aaeb233d819f519d16a9eb85a6eef Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 13 Feb 2023 11:52:19 +0100 Subject: Add wait_for_replay_catchup wrapper to Cluster.pm This simplifies a few lines of Perl test code a bit. Author: Bertrand Drouvot Discussion: https://postgr.es/m/846724b5-0723-f4c2-8b13-75301ec7509e@gmail.com --- src/test/perl/PostgreSQL/Test/Cluster.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/test/perl/PostgreSQL/Test') diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 04921ca3a3d..3e2a27fb717 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -2711,6 +2711,29 @@ sub wait_for_catchup =pod +=item $node->wait_for_replay_catchup($standby_name [, $base_node ]) + +Wait for the replication connection with application_name I<$standby_name> +until its B replication column in pg_stat_replication in I<$node> +equals or passes the I<$base_node>'s B. If I<$base_node> is +omitted, the LSN to wait for is obtained from I<$node>. + +The replication connection must be in a streaming state. + +Requires that the 'postgres' db exists and is accessible. + +This is not a test. It die()s on failure. + +=cut + +sub wait_for_replay_catchup +{ + my ($self, $standby_name, $node) = @_; + $node = defined($node) ? $node : $self; + + $self->wait_for_catchup($standby_name, 'replay', $node->lsn('flush')); +} + =item $node->wait_for_slot_catchup(slot_name, mode, target_lsn) Wait for the named replication slot to equal or pass the supplied target_lsn. -- cgit v1.2.3