Skip to content

Commit

Permalink
Fix autocommit when loading data
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 11, 2020
1 parent 72c5634 commit d3ebc95
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tpcc_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,16 @@ function load_tables(drv, con, warehouse_num)
local query

-- print(string.format("Creating warehouse: %d\n", warehouse_num))
if drv:name() == "mysql"
then
con:query("SET SESSION autocommit=1")
con:query("SET SESSION sql_log_bin = 0")
con:query("SET @trx = (SELECT @@global.innodb_flush_log_at_trx_commit)")
con:query("SET GLOBAL innodb_flush_log_at_trx_commit=0")
end

for table_num = 1, sysbench.opt.tables do
--con:query("SET autocommit=1")

print(string.format("loading tables: %d for warehouse: %d\n", table_num, warehouse_num))

Expand Down Expand Up @@ -582,6 +590,12 @@ function load_tables(drv, con, warehouse_num)

end

if drv:name() == "mysql"
then
-- con:query("SET @trx = (SELECT @@global.innodb_flush_log_at_trx_commit=0)")
con:query("SET GLOBAL innodb_flush_log_at_trx_commit=@trx")
end

end


Expand Down

0 comments on commit d3ebc95

Please sign in to comment.