Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add skip_existing_tables flag #470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lua/oltp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ sysbench.cmdline.options = {
{"Use a secondary index in place of the PRIMARY KEY", false},
create_secondary =
{"Create a secondary index in addition to the PRIMARY KEY", true},
skip_existing_tables =
{"If a table already exists during prepare, " ..
"skip and assume it has enough rows", true},
reconnect =
{"Reconnect after every N events. The default (0) is to not reconnect",
0},
Expand Down Expand Up @@ -160,6 +163,14 @@ function create_table(drv, con, table_num)
local extra_table_options = ""
local query

if sysbench.opt.skip_existing_tables then
rs = con:query("SHOW TABLE STATUS like 'sbtest" .. table_num .. "'")
if rs.nrows >= 1 then
print(string.format("Skipping create table 'sbtest%d'...", table_num))
return
end
end

if sysbench.opt.secondary then
id_index_def = "KEY xid"
else
Expand Down