aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-01-15 15:47:00 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-01-15 15:47:00 -0500
commit46cf109089e8b0eeb3370c0f482b0aaf0becaae0 (patch)
treee2d0bfd6947e5103e8eece089b5dce9c1edcd725 /src
parent20b9fa308ebf7d4a26ac53804fce1c30f781d60c (diff)
downloadpostgresql-46cf109089e8b0eeb3370c0f482b0aaf0becaae0.tar.gz
postgresql-46cf109089e8b0eeb3370c0f482b0aaf0becaae0.zip
Add simple test for physical replication of sequences.
AFAICS we had no coverage of this point except in the seldom-used, slated-for-removal standby_schedule test suite. Sequence updates are enough different from regular table updates that it seems worth covering them explicitly in src/test/recovery. Discussion: https://postgr.es/m/999497.1641431891@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/test/recovery/t/001_stream_rep.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 0f3b04e366f..fb8f66878ae 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -6,7 +6,7 @@ use strict;
use warnings;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
-use Test::More tests => 53;
+use Test::More tests => 55;
# Initialize primary node
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
@@ -42,7 +42,7 @@ $node_standby_2->init_from_backup($node_standby_1, $backup_name,
has_streaming => 1);
$node_standby_2->start;
-# Create some content on primary and check its presence in standby 1
+# Create some content on primary and check its presence in standby nodes
$node_primary->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1002) AS a");
@@ -62,6 +62,24 @@ $result =
print "standby 2: $result\n";
is($result, qq(1002), 'check streamed content on standby 2');
+# Likewise, but for a sequence
+$node_primary->safe_psql('postgres',
+ "CREATE SEQUENCE seq1; SELECT nextval('seq1')");
+
+# Wait for standbys to catch up
+$node_primary->wait_for_catchup($node_standby_1, 'replay',
+ $node_primary->lsn('insert'));
+$node_standby_1->wait_for_catchup($node_standby_2, 'replay',
+ $node_standby_1->lsn('replay'));
+
+$result = $node_standby_1->safe_psql('postgres', "SELECT * FROM seq1");
+print "standby 1: $result\n";
+is($result, qq(33|0|t), 'check streamed sequence content on standby 1');
+
+$result = $node_standby_2->safe_psql('postgres', "SELECT * FROM seq1");
+print "standby 2: $result\n";
+is($result, qq(33|0|t), 'check streamed sequence content on standby 2');
+
# Check that only READ-only queries can run on standbys
is($node_standby_1->psql('postgres', 'INSERT INTO tab_int VALUES (1)'),
3, 'read-only queries on standby 1');