diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2023-02-13 11:52:19 +0100 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2023-02-13 11:52:19 +0100 |
commit | a1acdacada4aaeb233d819f519d16a9eb85a6eef (patch) | |
tree | 34d25d2d80d2c33b0adea841ff0c06c655f35d9e /src/test/perl | |
parent | ec5a010ab25bf40012fde78b34724971e38e08a4 (diff) | |
download | postgresql-a1acdacada4aaeb233d819f519d16a9eb85a6eef.tar.gz |
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
Diffstat (limited to 'src/test/perl')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Cluster.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 04921ca3a3..3e2a27fb71 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<replay> replication column in pg_stat_replication in I<$node> +equals or passes the I<$base_node>'s B<replay_lsn>. 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. |