diff options
author | Amit Kapila <akapila@postgresql.org> | 2023-04-28 08:45:19 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2023-04-28 08:45:19 +0530 |
commit | 4d26d93ff7fbf7bde5710595255ca9c8033a1402 (patch) | |
tree | dce77b5aba3224a142caa071162c23fd3e98c849 | |
parent | b72623671d9c0ead4ac219c69762246073fe2185 (diff) | |
download | postgresql-4d26d93ff7fbf7bde5710595255ca9c8033a1402.tar.gz |
Improve one of the test cases in 035_standby_logical_decoding.pl.
The test to ensure that decoding changes via logical slot from another
database will fail was incorrectly done on the primary node instead of on
the standby node.
In the passing, make the test to wait for replay catchup by using
wait_for_replay_catchup(). This will make it consistent with the way we
wait at other places in the test.
Author: Shi yu
Reviewed-by: Bertrand Drouvot, Amit Kapila
Discussion: https://postgr.es/m/OSZPR01MB6310B0A507A0F2A2D379F38CFD6A9@OSZPR01MB6310.jpnprd01.prod.outlook.com
-rw-r--r-- | src/test/recovery/t/035_standby_logical_decoding.pl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl index f6d6447412..66d264f230 100644 --- a/src/test/recovery/t/035_standby_logical_decoding.pl +++ b/src/test/recovery/t/035_standby_logical_decoding.pl @@ -361,7 +361,7 @@ $node_primary->safe_psql('testdb', qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(5,50) s;] ); -$node_primary->wait_for_catchup($node_standby); +$node_primary->wait_for_replay_catchup($node_standby); my $stdout_recv = $node_standby->pg_recvlogical_upto( 'testdb', 'behaves_ok_activeslot', $endpos, $default_timeout, @@ -384,12 +384,17 @@ is($stdout_recv, '', 'pg_recvlogical acknowledged changes'); $node_primary->safe_psql('postgres', 'CREATE DATABASE otherdb'); -is( $node_primary->psql( +# Wait for catchup to ensure that the new database is visible to other sessions +# on the standby. +$node_primary->wait_for_replay_catchup($node_standby); + +($result, $stdout, $stderr) = $node_standby->psql( 'otherdb', "SELECT lsn FROM pg_logical_slot_peek_changes('behaves_ok_activeslot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" - ), - 3, - 'replaying logical slot from another database fails'); + ); +ok( $stderr =~ + m/replication slot "behaves_ok_activeslot" was not created in this database/, + "replaying logical slot from another database fails"); ################################################## # Test that we can subscribe on the standby with the publication |