|
6 | 6 | use warnings; |
7 | 7 | use PostgreSQL::Test::Cluster; |
8 | 8 | use PostgreSQL::Test::Utils; |
9 | | -use Test::More tests => 53; |
| 9 | +use Test::More tests => 55; |
10 | 10 |
|
11 | 11 | # Initialize primary node |
12 | 12 | my $node_primary = PostgreSQL::Test::Cluster->new('primary'); |
|
42 | 42 | has_streaming => 1); |
43 | 43 | $node_standby_2->start; |
44 | 44 |
|
45 | | -# Create some content on primary and check its presence in standby 1 |
| 45 | +# Create some content on primary and check its presence in standby nodes |
46 | 46 | $node_primary->safe_psql('postgres', |
47 | 47 | "CREATE TABLE tab_int AS SELECT generate_series(1,1002) AS a"); |
48 | 48 |
|
|
62 | 62 | print "standby 2: $result\n"; |
63 | 63 | is($result, qq(1002), 'check streamed content on standby 2'); |
64 | 64 |
|
| 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 | + |
65 | 83 | # Check that only READ-only queries can run on standbys |
66 | 84 | is($node_standby_1->psql('postgres', 'INSERT INTO tab_int VALUES (1)'), |
67 | 85 | 3, 'read-only queries on standby 1'); |
|
0 commit comments