Fix timing issue in deadlock recovery conflict test.
authorAndres Freund <[email protected]>
Wed, 4 May 2022 19:50:38 +0000 (12:50 -0700)
committerAndres Freund <[email protected]>
Wed, 4 May 2022 19:57:32 +0000 (12:57 -0700)
Per buildfarm members longfin and skink.

Discussion: https://postgr.es/m/20220413002626[email protected]
Backpatch: 10-

src/test/recovery/t/031_recovery_conflict.pl

index aa36582d1100973c30af16367ae7dfe67d45ebc1..a2e4c659f20fce81945dc290a1b710103cd3ce92 100644 (file)
@@ -231,6 +231,14 @@ check_conflict_stat("lock");
 $sect = "startup deadlock";
 $expected_conflicts++;
 
+# Want to test recovery deadlock conflicts, not buffer pin conflicts. Without
+# changing max_standby_streaming_delay it'd be timing dependent what we hit
+# first
+$node_standby->adjust_conf('postgresql.conf', 'max_standby_streaming_delay',
+                          "${PostgreSQL::Test::Utils::timeout_default}s");
+$node_standby->restart();
+reconnect_and_clear();
+
 # Generate a few dead rows, to later be cleaned up by vacuum. Then acquire a
 # lock on another relation in a prepared xact, so it's held continuously by
 # the startup process. The standby psql will block acquiring that lock while
@@ -286,6 +294,9 @@ check_conflict_stat("deadlock");
 
 # clean up for next tests
 $node_primary->safe_psql($test_db, qq[ROLLBACK PREPARED 'lock';]);
+$node_standby->adjust_conf('postgresql.conf', 'max_standby_streaming_delay', '50ms');
+$node_standby->restart();
+reconnect_and_clear();
 
 
 # Check that expected number of conflicts show in pg_stat_database. Needs to