Add oltp_delete_inserts flag to oltp.lua

Bug #1537220 reported by Peter Friedenbach on 2016-01-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysbench
Undecided
Unassigned

Bug Description

To increase the ability to customize the types of "writes" in a test, I am requesting that a new flag "oltp_delete_inserts" be added to selectively control the number of delete and inserts performed.

Current code:

  i = sb_rand(1, oltp_table_size)

   rs = db_query("DELETE FROM " .. table_name .. " WHERE id=" .. i)

   c_val = sb_rand_str([[
###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]])
   pad_val = sb_rand_str([[
###########-###########-###########-###########-###########]])

   rs = db_query("INSERT INTO " .. table_name .. " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, sb_rand(1, oltp_table_size) , c_val
, pad_val))

Modified Code:

   for i=1, oltp_delete_inserts do

   i = sb_rand(1, oltp_table_size)

   rs = db_query("DELETE FROM " .. table_name .. " WHERE id=" .. i)

   c_val = sb_rand_str([[
###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]])
   pad_val = sb_rand_str([[
###########-###########-###########-###########-###########]])

   rs = db_query("INSERT INTO " .. table_name .. " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, sb_rand(1, oltp_table_size) , c_val
, pad_val))

   end

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers