Skip to content

Commit 729ddd3

Browse files
committed
fix messages and comments in test
1 parent bb2f701 commit 729ddd3

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/test/recovery/t/006_twophase.pl

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
my $psql_rc = '';
3131

3232
###############################################################################
33-
# Check that we can commit and abort after soft restart.
33+
# Check that we can commit and abort tx after soft restart.
3434
# Here checkpoint happens before shutdown and no WAL replay will not occur
35-
# during start. So code should re-create memory state from files.
35+
# during start. So postgres should re-create memory state from files.
3636
###############################################################################
3737

3838
$node_master->psql('postgres', "
@@ -54,10 +54,11 @@
5454
###############################################################################
5555
# Check that we can commit and abort after hard restart.
5656
# On startup WAL replay will re-create memory for global transactions that
57-
# happend after last checkpoint and stored.
57+
# happend after the last checkpoint.
5858
###############################################################################
5959

6060
$node_master->psql('postgres', "
61+
checkpoint;
6162
begin;
6263
insert into t values (42);
6364
prepare transaction 'x';
@@ -78,6 +79,7 @@
7879
###############################################################################
7980

8081
$node_master->psql('postgres', "
82+
checkpoint;
8183
begin;
8284
insert into t values (42);
8385
prepare transaction 'x';
@@ -89,7 +91,7 @@
8991
$node_master->start;
9092

9193
$psql_rc = $node_master->psql('postgres', "commit prepared 'x'");
92-
is($psql_rc, '0', 'Check that we can replay several tx with same name.');
94+
is($psql_rc, '0', 'Replay several tx with same name.');
9395

9496
###############################################################################
9597
# Check that WAL replay will cleanup it's memory state and release locks while
@@ -107,14 +109,14 @@
107109
begin;
108110
insert into t values (42);
109111
-- This prepare can fail due to 2pc identifier or locks conflicts if replay
110-
-- didn't cleanup proc, gxact or locks on commit.
112+
-- didn't fully cleanup it's state on commit.
111113
prepare transaction 'x';");
112-
is($psql_rc, '0', "Check that WAL replay will cleanup it's memory state");
114+
is($psql_rc, '0', "Check that replay will cleanup it's memory state");
115+
113116
$node_master->psql('postgres', "commit prepared 'x'");
114117

115118
###############################################################################
116-
# Check that we can commit while running active sync slave and that there is no
117-
# active prepared transaction on slave after that.
119+
# Check that WAL replay will cleanup it's memory state on running slave.
118120
###############################################################################
119121

120122
$node_master->psql('postgres', "
@@ -124,7 +126,7 @@
124126
commit prepared 'x';
125127
");
126128
$node_slave->psql('postgres', "select count(*) from pg_prepared_xacts;", stdout => \$psql_out);
127-
is($psql_out, '0', "Check that WAL replay will cleanup it's memory state on slave");
129+
is($psql_out, '0', "Check that replay will cleanup it's memory state on running slave");
128130

129131
###############################################################################
130132
# The same as in previous case, but let's force checkpoint on slave between
@@ -139,7 +141,7 @@
139141
$node_slave->psql('postgres',"checkpoint;");
140142
$node_master->psql('postgres', "commit prepared 'x';");
141143
$node_slave->psql('postgres', "select count(*) from pg_prepared_xacts;", stdout => \$psql_out);
142-
is($psql_out, '0', "Check that WAL replay will cleanup it's memory state on slave after checkpoint");
144+
is($psql_out, '0', "Check that replay will cleanup it's memory state on slave after checkpoint");
143145

144146
###############################################################################
145147
# Check that we can commit transaction on promoted slave.
@@ -153,8 +155,9 @@
153155
$node_master->teardown_node;
154156
$node_slave->promote;
155157
$node_slave->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true");
158+
156159
$psql_rc = $node_slave->psql('postgres', "commit prepared 'x';");
157-
is($psql_rc, '0', "Check that we can commit transaction on promoted slave.");
160+
is($psql_rc, '0', "Restore prepared transaction on promoted slave.");
158161

159162
# change roles
160163
($node_master, $node_slave) = ($node_slave, $node_master);
@@ -166,7 +169,8 @@
166169

167170
###############################################################################
168171
# Check that we restore prepared xacts after slave soft restart while master is
169-
# down.
172+
# down. Since slave knows that master is down it uses different code path on
173+
# start.
170174
###############################################################################
171175

172176
$node_master->psql('postgres', "
@@ -178,8 +182,9 @@
178182
$node_slave->restart;
179183
$node_slave->promote;
180184
$node_slave->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true");
185+
181186
$node_slave->psql('postgres',"select count(*) from pg_prepared_xacts", stdout => \$psql_out);
182-
is($psql_out, '1', "Check that we restore prepared xacts after slave soft restart while master is down.");
187+
is($psql_out, '1', "Restore prepared xacts after slave soft restart while master is down.");
183188

184189
# restore state
185190
($node_master, $node_slave) = ($node_slave, $node_master);
@@ -205,8 +210,9 @@
205210
$node_slave->start;
206211
$node_slave->promote;
207212
$node_slave->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true");
213+
208214
$node_slave->psql('postgres',"select count(*) from pg_prepared_xacts", stdout => \$psql_out);
209-
is($psql_out, '1', "Check that we restore prepared xacts after slave hard restart while master is down.");
215+
is($psql_out, '1', "Restore prepared xacts after slave hard restart while master is down.");
210216

211217
# restore state
212218
($node_master, $node_slave) = ($node_slave, $node_master);

0 commit comments

Comments
 (0)