File tree 3 files changed +18
-17
lines changed
3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -35,24 +35,19 @@ function event()
35
35
-- print( NURand (1023,1,3000))
36
36
local trx_type = sysbench .rand .uniform (1 ,23 )
37
37
if trx_type <= 10 then
38
- -- print("new_order")
39
- trx = new_order
38
+ trx = " new_order"
40
39
elseif trx_type <= 20 then
41
- -- print("payment")
42
- trx = payment
40
+ trx = " payment"
43
41
elseif trx_type <= 21 then
44
- -- print("order status")
45
- trx = orderstatus
42
+ trx = " orderstatus"
46
43
elseif trx_type <= 22 then
47
- -- print("delivery")
48
- trx = delivery
44
+ trx = " delivery"
49
45
elseif trx_type <= 23 then
50
- -- print("stock")
51
- trx = stocklevel
46
+ trx = " stocklevel"
52
47
end
53
48
54
49
-- Repeat transaction execution until success
55
- while not pcall (function () trx () end ) do
50
+ while not pcall (function () _G [ trx ] () end ) do
56
51
con :query (" ROLLBACK" )
57
52
end
58
53
Original file line number Diff line number Diff line change 18
18
-- Common code for TPCC benchmarks.
19
19
-- -----------------------------------------------------------------------------
20
20
21
+ ffi = require (" ffi" )
22
+
23
+ ffi .cdef [[
24
+ void sb_counter_inc (int , sb_counter_type );
25
+ ]]
26
+
27
+
21
28
function init ()
22
29
assert (event ~= nil ,
23
30
" this script is meant to be included by other TPCC scripts and " ..
@@ -337,14 +344,12 @@ function set_isolation_level(drv,con)
337
344
elseif sysbench .opt .trx_level == " SER" then
338
345
isolation_level = " SERIALIZABLE"
339
346
end
340
-
347
+
341
348
rs = con :query (" SHOW VARIABLES LIKE 't%_isolation'" )
342
349
row = rs :fetch_row ()
343
350
isolation_variable = row [1 ]
344
351
345
352
con :query (" SET SESSION " .. isolation_variable .. " ='" .. isolation_level .. " '" )
346
- -- con:query("SET SESSION transaction_isolation='".. isolation_level .."'")
347
- -- con:query("SET SESSION tx_isolation='".. isolation_level .."'")
348
353
end
349
354
end
350
355
Original file line number Diff line number Diff line change @@ -160,10 +160,11 @@ function new_order()
160
160
local i_data
161
161
162
162
if rs .nrows == 0 then
163
- -- print("ROLLBACK")
164
- con :query (" ROLLBACK" )
163
+ -- print("ROLLBACK")
164
+ ffi .C .sb_counter_inc (sysbench .tid , ffi .C .SB_CNT_ERROR )
165
+ con :query (" ROLLBACK" )
165
166
return
166
- end
167
+ end
167
168
168
169
for i = 1 , rs .nrows do
169
170
row = rs :fetch_row ()
You can’t perform that action at this time.
0 commit comments