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

Commit3c03d85

Browse files
author
Marina Polyakova
committed
Pgbench Fix TAP tests 3
- give Pgbench more time to run its first transaction- do not check the number of failures if the failed 'Read committed' transactionwas retried after a deadlock (a deadlock failure can occur again)
1 parent6b3102b commit3c03d85

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

‎src/bin/pgbench/t/002_serialization_and_deadlock_failures.pl

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Config;
55
use PostgresNode;
66
use TestLib;
7-
use Test::Moretests=>58;
7+
use Test::Moretests=>63;
88

99
use constant
1010
{
@@ -38,7 +38,7 @@
3838
."\\set delta1 random(-5000, 5000)\n"
3939
."\\set delta2 random(-5000, 5000)\n"
4040
."UPDATE xy SET y = y + :delta1 WHERE x = 1;\n"
41-
."SELECT pg_sleep(20);\n"
41+
."SELECT pg_sleep(60);\n"
4242
."UPDATE xy SET y = y + :delta2 WHERE x = 2;\n"
4343
."END;");
4444

@@ -87,7 +87,7 @@ sub test_pgbench_default_transaction_isolation_level_and_serialization_failures
8787
\$err_pgbench;
8888

8989
# Let pgbench run the update command in the transaction:
90-
sleep10;
90+
sleep30;
9191

9292
# In psql, commit the transaction and end the session:
9393
$in_psql ="end;\n";
@@ -183,7 +183,7 @@ sub test_pgbench_serialization_failures_retry
183183
\$stderr;
184184

185185
# Let pgbench run the update command in the transaction:
186-
sleep10;
186+
sleep30;
187187

188188
# In psql, commit the transaction and end the session:
189189
$in_psql ="end;\n";
@@ -269,7 +269,7 @@ sub test_pgbench_deadlock_failures
269269
$h1 = IPC::Run::start \@command1, \$in1, \$out1, \$err1;
270270

271271
# Let pgbench run first update command in the transaction:
272-
sleep10;
272+
sleep30;
273273

274274
# Run second pgbench
275275
my@command2 = (
@@ -357,7 +357,7 @@ sub test_pgbench_deadlock_failures_retry
357357
$h1 = IPC::Run::start \@command1, \$in1, \$out1, \$err1;
358358

359359
# Let pgbench run first update command in the transaction:
360-
sleep10;
360+
sleep30;
361361

362362
# Run second pgbench
363363
my@command2 = (
@@ -408,26 +408,33 @@ sub test_pgbench_deadlock_failures_retry
408408
.$isolation_level_sql
409409
.": pgbench 2: check processed transactions");
410410

411-
# First or second pgbench should get a deadlock error
411+
# First or second pgbench should get a deadlock error which was retried
412412
like($err1 .$err2,
413413
qr{client 0 got a deadlock failure\(try 1/2\)},
414414
"concurrent deadlock update with retrying:"
415415
.$isolation_level_sql
416416
.": check deadlock failure");
417417

418+
like($out1 .$out2,
419+
qr{number of transactions retried: 1\(100.000 %\)},
420+
"concurrent deadlock update with retrying:"
421+
.$isolation_level_sql
422+
.": check retried transactions");
423+
424+
like($out1 .$out2,
425+
qr{number of retries: 1\(serialization: 0, deadlocks: 1\)},
426+
"concurrent deadlock update with retrying:"
427+
.$isolation_level_sql
428+
.": check retries");
429+
418430
if ($isolation_level == READ_COMMITTED)
419431
{
420432
# At other isolation levels, there may be serialization failures
421-
like($out1 .$out2,
422-
qr{^((?!number of failures)(.|\n))*$},
423-
"concurrent deadlock update with retrying:"
424-
.$isolation_level_sql
425-
.": check failures");
426433

427434
my$pattern =
428435
"client 0 sending UPDATE xy SET y = y\\+ (-?\\d+) WHERE x = (\\d);\n"
429436
."(client 0 receiving\n)+"
430-
."(|client 0 sending SELECT pg_sleep\\(20\\);\n)"
437+
."(|client 0 sending SELECT pg_sleep\\(60\\);\n)"
431438
."\\g3*"
432439
."client 0 sending UPDATE xy SET y = y\\+ (-?\\d+) WHERE x = (\\d);\n"
433440
."\\g3+"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp