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

Commit46cf109

Browse files
committed
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 updatesare enough different from regular table updates that it seems worthcovering them explicitly in src/test/recovery.Discussion:https://postgr.es/m/999497.1641431891@sss.pgh.pa.us
1 parent20b9fa3 commit46cf109

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

‎src/test/recovery/t/001_stream_rep.pl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use warnings;
77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::Moretests=>53;
9+
use Test::Moretests=>55;
1010

1111
# Initialize primary node
1212
my$node_primary = PostgreSQL::Test::Cluster->new('primary');
@@ -42,7 +42,7 @@
4242
has_streaming=> 1);
4343
$node_standby_2->start;
4444

45-
# Create some content on primary and check its presence in standby1
45+
# Create some content on primary and check its presence in standbynodes
4646
$node_primary->safe_psql('postgres',
4747
"CREATE TABLE tab_int AS SELECT generate_series(1,1002) AS a");
4848

@@ -62,6 +62,24 @@
6262
print"standby 2:$result\n";
6363
is($result,qq(1002),'check streamed content on standby 2');
6464

65+
# Likewise, but for a sequence
66+
$node_primary->safe_psql('postgres',
67+
"CREATE SEQUENCE seq1; SELECT nextval('seq1')");
68+
69+
# Wait for standbys to catch up
70+
$node_primary->wait_for_catchup($node_standby_1,'replay',
71+
$node_primary->lsn('insert'));
72+
$node_standby_1->wait_for_catchup($node_standby_2,'replay',
73+
$node_standby_1->lsn('replay'));
74+
75+
$result =$node_standby_1->safe_psql('postgres',"SELECT * FROM seq1");
76+
print"standby 1:$result\n";
77+
is($result,qq(33|0|t),'check streamed sequence content on standby 1');
78+
79+
$result =$node_standby_2->safe_psql('postgres',"SELECT * FROM seq1");
80+
print"standby 2:$result\n";
81+
is($result,qq(33|0|t),'check streamed sequence content on standby 2');
82+
6583
# Check that only READ-only queries can run on standbys
6684
is($node_standby_1->psql('postgres','INSERT INTO tab_int VALUES (1)'),
6785
3,'read-only queries on standby 1');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp