Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfcd77d5

Browse files
committed
TAP test for logical decoding on standby
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>Author: Amit Khandekar <amitdkhan.pg@gmail.com>Author: Craig Ringer <craig@2ndquadrant.com> (in an older version)Author: Andres Freund <andres@anarazel.de>Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>Reviewed-by: Andres Freund <andres@anarazel.de>Reviewed-by: Robert Haas <robertmhaas@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
1 parent0fdab27 commitfcd77d5

File tree

3 files changed

+772
-0
lines changed

3 files changed

+772
-0
lines changed

‎src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,6 +3029,43 @@ $SIG{TERM} = $SIG{INT} = sub {
30293029

30303030
=pod
30313031
3032+
=item$node->create_logical_slot_on_standby(self, primary, slot_name, dbname)
3033+
3034+
Create logical replication slot on given standby
3035+
3036+
=cut
3037+
3038+
subcreate_logical_slot_on_standby
3039+
{
3040+
my ($self,$primary,$slot_name,$dbname) =@_;
3041+
my ($stdout,$stderr);
3042+
3043+
my$handle;
3044+
3045+
$handle = IPC::Run::start(['pg_recvlogical','-d',$self->connstr($dbname),'-P','test_decoding','-S',$slot_name,'--create-slot'],'>', \$stdout,'2>', \$stderr);
3046+
3047+
# Once the slot's restart_lsn is determined, the standby looks for
3048+
# xl_running_xacts WAL record from the restart_lsn onwards. First wait
3049+
# until the slot restart_lsn is determined.
3050+
3051+
$self->poll_query_until(
3052+
'postgres',qq[
3053+
SELECT restart_lsn IS NOT NULL
3054+
FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name'
3055+
])ordie"timed out waiting for logical slot to calculate its restart_lsn";
3056+
3057+
# Then arrange for the xl_running_xacts record for which pg_recvlogical is
3058+
# waiting.
3059+
$primary->safe_psql('postgres','SELECT pg_log_standby_snapshot()');
3060+
3061+
$handle->finish();
3062+
3063+
is($self->slot($slot_name)->{'slot_type'},'logical',$slot_name .' on standby created')
3064+
ordie"could not create slot" .$slot_name;
3065+
}
3066+
3067+
=pod
3068+
30323069
=back
30333070
30343071
=cut

‎src/test/recovery/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ tests += {
4040
't/032_relfilenode_reuse.pl',
4141
't/033_replay_tsp_drops.pl',
4242
't/034_create_database.pl',
43+
't/035_standby_logical_decoding.pl',
4344
],
4445
},
4546
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp