3535my $script1 =$node -> basedir .' /pgbench_script1' ;
3636append_to_file($script1 ,
3737" BEGIN;\n "
38+ ." SELECT pg_sleep(10);\n "
3839 ." \\ set delta1 random(-5000, 5000)\n "
3940 ." \\ set delta2 random(-5000, 5000)\n "
4041 ." UPDATE xy SET y = y + :delta1 WHERE x = 1;\n "
41- ." SELECT pg_sleep(20 );\n "
42+ ." SELECT pg_sleep(40 );\n "
4243 ." UPDATE xy SET y = y + :delta2 WHERE x = 2;\n "
4344 ." END;" );
4445
4546my $script2 =$node -> basedir .' /pgbench_script2' ;
4647append_to_file($script2 ,
4748" BEGIN;\n "
49+ ." SELECT pg_sleep(10);\n "
4850 ." \\ set delta1 random(-5000, 5000)\n "
4951 ." \\ set delta2 random(-5000, 5000)\n "
5052 ." UPDATE xy SET y = y + :delta2 WHERE x = 2;\n "
@@ -180,8 +182,9 @@ sub test_pgbench_deadlock_failures
180182print " # Running:" .join (" " ,@command1 ) ." \n " ;
181183$h1 = IPC::Run::start \@command1 , \$in1 , \$out1 , \$err1 ;
182184
183- # Let pgbench run first update command in the transaction:
184- sleep 10;
185+ # Let pgbench sleep 10 seconds and run first update command in the
186+ # transaction:
187+ sleep 20;
185188
186189# Run second pgbench
187190my @command2 = (
@@ -258,7 +261,7 @@ sub test_pgbench_deadlock_failures
258261my $pattern =
259262" client 0 sending UPDATE xy SET y = y\\ + (-?\\ d+) WHERE x = (\\ d);\n "
260263 ." client 0 receiving\n "
261- ." (|client 0 sending SELECT pg_sleep\\ (20 \\ );\n "
264+ ." (|client 0 sending SELECT pg_sleep\\ (40 \\ );\n "
262265 ." client 0 receiving\n )"
263266 ." client 0 sending UPDATE xy SET y = y\\ + (-?\\ d+) WHERE x = (\\ d);\n "
264267 ." client 0 receiving\n "
@@ -268,6 +271,8 @@ sub test_pgbench_deadlock_failures
268271 ." client 0 repeats the failed transaction\\ (attempt 2/2\\ )\n "
269272 ." client 0 sending BEGIN;\n "
270273 ." client 0 receiving\n "
274+ ." client 0 sending SELECT pg_sleep\\ (10\\ );\n "
275+ ." client 0 receiving\n "
271276 ." client 0 executing\\\\ set delta1\n "
272277 ." client 0 executing\\\\ set delta2\n "
273278 ." client 0 sending UPDATE xy SET y = y\\ +\\ g1 WHERE x =\\ g2;\n "