|
214 | 214 |
|
215 | 215 | ## RECOVERY CONFLICT 5: Deadlock |
216 | 216 | $sect = "startup deadlock"; |
217 | | -$expected_conflicts++; |
218 | 217 |
|
219 | 218 | # Want to test recovery deadlock conflicts, not buffer pin conflicts. Without |
220 | 219 | # changing max_standby_streaming_delay it'd be timing dependent what we hit |
|
226 | 225 | $node_standby->restart(); |
227 | 226 | $psql_standby->reconnect_and_clear(); |
228 | 227 |
|
| 228 | +for (my $i = 1; $i <= 100; $i++) { |
| 229 | +diag("iteration $i"); |
| 230 | + |
| 231 | +$expected_conflicts++; |
| 232 | + |
229 | 233 | # Generate a few dead rows, to later be cleaned up by vacuum. Then acquire a |
230 | 234 | # lock on another relation in a prepared xact, so it's held continuously by |
231 | 235 | # the startup process. The standby psql will block acquiring that lock while |
232 | 236 | # holding a pin that vacuum needs, triggering the deadlock. |
233 | 237 | $node_primary->safe_psql( |
234 | 238 | $test_db, |
235 | 239 | qq[ |
| 240 | +DROP TABLE IF EXISTS $table1; |
236 | 241 | CREATE TABLE $table1(a int, b int); |
237 | 242 | INSERT INTO $table1 VALUES (1); |
238 | 243 | BEGIN; |
|
274 | 279 |
|
275 | 280 | check_conflict_log("User transaction caused buffer deadlock with recovery."); |
276 | 281 | $psql_standby->reconnect_and_clear(); |
277 | | -check_conflict_stat("deadlock"); |
| 282 | +## check_conflict_stat("deadlock"); |
278 | 283 |
|
279 | 284 | # clean up for next tests |
280 | 285 | $node_primary->safe_psql($test_db, qq[ROLLBACK PREPARED 'lock';]); |
| 286 | + |
| 287 | +$node_standby->restart(); |
| 288 | +$psql_standby->reconnect_and_clear(); |
| 289 | + |
| 290 | +} |
| 291 | + |
| 292 | +# clean up for next tests |
| 293 | +## $node_primary->safe_psql($test_db, qq[ROLLBACK PREPARED 'lock';]); |
281 | 294 | $node_standby->adjust_conf('postgresql.conf', 'max_standby_streaming_delay', |
282 | 295 | '50ms'); |
283 | 296 | $node_standby->restart(); |
|
0 commit comments