Skip to content

Commit

Permalink
execute_delete_inserts: fix for opt.use_file - fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rockeet committed Sep 23, 2022
1 parent f9458f4 commit 53f7263
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/lua/oltp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ local stmt_defs = {
t.INT},
inserts = {
"INSERT INTO sbtest%u (id, k, c, pad) VALUES (?, ?, ?, ?)",
t.INT, t.INT, {t.CHAR, 120}, {t.CHAR, 60}},
t.INT, t.INT, {t.CHAR, 120},
{t.VARCHAR, 4194000}}, --lua bind VARCHAR can be larger than MySQL(65535)
}

function prepare_begin()
Expand Down Expand Up @@ -524,6 +525,7 @@ end

function execute_delete_inserts()
local tnum = get_table_num()
local file_c_val, file_pad_val

for i = 1, sysbench.opt.delete_inserts do
local id = get_id()
Expand All @@ -533,8 +535,14 @@ function execute_delete_inserts()

param[tnum].inserts[1]:set(id)
param[tnum].inserts[2]:set(k)
param[tnum].inserts[3]:set_rand_str(c_value_template)
param[tnum].inserts[4]:set_rand_str(pad_value_template)
if sysbench.opt.use_file then
file_c_val, file_pad_val = get_str_value()
param[tnum].inserts[3]:set(file_c_val)
param[tnum].inserts[4]:set(file_pad_val)
else
param[tnum].inserts[3]:set_rand_str(c_value_template)
param[tnum].inserts[4]:set_rand_str(pad_value_template)
end

stmt[tnum].deletes:execute()
stmt[tnum].inserts:execute()
Expand Down

0 comments on commit 53f7263

Please sign in to comment.