Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e45d44

Browse files
author
Marina Polyakova
committed
Pgbench Fix TAP tests for retrying failed transactions
1 parent8855aa3 commit3e45d44

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/bin/pgbench/t/004_retry_failed_transactions.pl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@
3535
my$script1 =$node->basedir .'/pgbench_script1';
3636
append_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

4546
my$script2 =$node->basedir .'/pgbench_script2';
4647
append_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
180182
print"# 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
187190
my@command2 = (
@@ -258,7 +261,7 @@ sub test_pgbench_deadlock_failures
258261
my$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"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp