|
8 | 8 | use warnings; |
9 | 9 | use PostgresNode; |
10 | 10 | use TestLib; |
11 | | -use Test::More tests => 2; |
| 11 | +use Test::More tests => 1; |
12 | 12 |
|
13 | 13 | # Find the largest LSN in the set of pages part of the given relation |
14 | 14 | # file. This is used for offline checks of page consistency. The LSN |
@@ -62,32 +62,8 @@ sub find_largest_lsn |
62 | 62 | $standby->init_from_backup($primary, 'bkp', has_streaming => 1); |
63 | 63 | $standby->start; |
64 | 64 |
|
65 | | -# Object creations for the upcoming tests: |
66 | | -# - Base table whose data consistency is checked. |
67 | | -# - pageinspect to look at the page-level contents. |
68 | | -# - Function wrapper on top of pageinspect to scan a range of pages and |
69 | | -# get the maximum LSN present. |
| 65 | +# Create base table whose data consistency is checked. |
70 | 66 | $primary->safe_psql('postgres', " |
71 | | -CREATE EXTENSION pageinspect; |
72 | | --- Function wrapper on top of pageinspect which fetches the largest LSN |
73 | | --- present in the given page range. |
74 | | -CREATE OR REPLACE FUNCTION max_lsn_range(relname text, |
75 | | - start_blk int, |
76 | | - end_blk int) |
77 | | -RETURNS pg_lsn as \$\$ |
78 | | -DECLARE |
79 | | - max_lsn pg_lsn = '0/0'::pg_lsn; |
80 | | - cur_lsn pg_lsn; |
81 | | -BEGIN |
82 | | - FOR i IN start_blk..end_blk LOOP |
83 | | - EXECUTE 'SELECT lsn FROM page_header(get_raw_page(''' || relname || ''',' || i || '));' INTO cur_lsn; |
84 | | - IF max_lsn < cur_lsn THEN |
85 | | - max_lsn = cur_lsn; |
86 | | - END IF; |
87 | | - END LOOP; |
88 | | - RETURN max_lsn; |
89 | | -END; |
90 | | -\$\$ LANGUAGE plpgsql; |
91 | 67 | CREATE TABLE test1 (a int) WITH (fillfactor = 10); |
92 | 68 | INSERT INTO test1 SELECT generate_series(1, 10000);"); |
93 | 69 |
|
@@ -161,19 +137,3 @@ BEGIN |
161 | 137 | # the pages on disk. |
162 | 138 | ok($offline_recovery_lsn ge $offline_max_lsn, |
163 | 139 | "Check offline that table data is consistent with minRecoveryPoint"); |
164 | | - |
165 | | -# Now restart the standby and check the state of the instance while |
166 | | -# online. Again, all the pages of the relation previously created |
167 | | -# should not have a LSN newer than what minRecoveryPoint has. |
168 | | -$standby->start; |
169 | | - |
170 | | -# Check that the last page of the table, which is the last one which |
171 | | -# has been flushed by the previous checkpoint on the standby, does not |
172 | | -# have a LSN newer than minRecoveryPoint. |
173 | | -my $psql_out; |
174 | | -$standby->psql( |
175 | | - 'postgres', |
176 | | - "SELECT max_lsn_range('test1', 0, $last_block) <= min_recovery_end_lsn FROM pg_control_recovery()", |
177 | | - stdout => \$psql_out); |
178 | | -is($psql_out, 't', |
179 | | - "Check online that table data is consistent with minRecoveryPoint"); |
0 commit comments