Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimtk committed Feb 28, 2018
1 parent 5d8b9a5 commit d7d3956
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tpcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function event()
end

-- Repeat transaction execution until success
while not pcall(function () trx() end ) do end
while not pcall(function () trx() end ) do
con:query("ROLLBACK")
end

end

Expand All @@ -61,17 +63,5 @@ function sysbench.hooks.report_intermediate(stat)
sysbench.report_csv(stat)
end

function sysbench.hooks.sql_error_ignorable(err)
if err.sql_errno == 1205 then
print("Lock timeout detected. Rollback")
con:query("ROLLBACK")
return true
end
if err.sql_errno == 1213 then
print("Deadlock detected. Rollback")
con:query("ROLLBACK")
return true
end
end

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

0 comments on commit d7d3956

Please sign in to comment.