Skip to content

Commit d7d3956

Browse files
committed
Error handling
1 parent 5d8b9a5 commit d7d3956

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

tpcc.lua

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function event()
5252
end
5353

5454
-- Repeat transaction execution until success
55-
while not pcall(function () trx() end ) do end
55+
while not pcall(function () trx() end ) do
56+
con:query("ROLLBACK")
57+
end
5658

5759
end
5860

@@ -61,17 +63,5 @@ function sysbench.hooks.report_intermediate(stat)
6163
sysbench.report_csv(stat)
6264
end
6365

64-
function sysbench.hooks.sql_error_ignorable(err)
65-
if err.sql_errno == 1205 then
66-
print("Lock timeout detected. Rollback")
67-
con:query("ROLLBACK")
68-
return true
69-
end
70-
if err.sql_errno == 1213 then
71-
print("Deadlock detected. Rollback")
72-
con:query("ROLLBACK")
73-
return true
74-
end
75-
end
7666

7767
-- vim:ts=4 ss=4 sw=4 expandtab

0 commit comments

Comments
 (0)