Merge branch '0.5' into 1.0

This commit is contained in:
Alexey Kopytov
2016-09-03 14:48:08 +03:00
2 changed files with 29 additions and 0 deletions

View File

@ -132,6 +132,13 @@ function set_vars()
oltp_distinct_ranges = oltp_distinct_ranges or 1
oltp_index_updates = oltp_index_updates or 1
oltp_non_index_updates = oltp_non_index_updates or 1
oltp_delete_inserts = oltp_delete_inserts or 1
if (oltp_range_selects == 'off') then
oltp_range_selects = false
else
oltp_range_selects = true
end
if (oltp_auto_inc == 'off') then
oltp_auto_inc = false
@ -145,6 +152,16 @@ function set_vars()
oltp_read_only = false
end
if (oltp_write_only == 'on') then
oltp_write_only = true
else
oltp_write_only = false
end
if (oltp_read_only and oltp_write_only) then
error("--oltp-read-only and --oltp-write-only are mutually exclusive")
end
if (oltp_skip_trx == 'on') then
oltp_skip_trx = true
else

View File

@ -34,11 +34,15 @@ function event(thread_id)
db_query(begin_query)
end
if not oltp_write_only then
for i=1, oltp_point_selects do
rs = db_query("SELECT c FROM ".. table_name .." WHERE id=" ..
sb_rand(1, oltp_table_size))
end
if oltp_range_selects then
for i=1, oltp_simple_ranges do
rs = db_query("SELECT c FROM ".. table_name .. get_range_str())
end
@ -57,6 +61,10 @@ function event(thread_id)
" ORDER BY c")
end
end
end
if not oltp_read_only then
for i=1, oltp_index_updates do
@ -72,6 +80,8 @@ function event(thread_id)
end
end
for i=1, oltp_delete_inserts do
i = sb_rand(1, oltp_table_size)
rs = db_query("DELETE FROM " .. table_name .. " WHERE id=" .. i)
@ -83,6 +93,8 @@ function event(thread_id)
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
end -- oltp_read_only
if not oltp_skip_trx then