Skip to content

Commit

Permalink
src/lua/oltp_common.lua: add parameter --skip-ddl
Browse files Browse the repository at this point in the history
  • Loading branch information
cyliu0 committed Nov 8, 2023
1 parent 1fa78cf commit ed8fd17
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/lua/oltp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ sysbench.cmdline.options = {
"client-generated IDs", true},
create_table_options =
{"Extra CREATE TABLE options", ""},
skip_ddl = {"Skip DDL", false},
skip_trx =
{"Don't start explicit transactions and execute all queries " ..
"in the AUTOCOMMIT mode", false},
Expand Down Expand Up @@ -189,20 +190,22 @@ function create_table(drv, con, table_num)
error("Unsupported database driver:" .. drv:name())
end

print(string.format("Creating table 'sbtest%d'...", table_num))
if not sysbench.opt.skip_ddl then
print(string.format("Creating table 'sbtest%d'...", table_num))

query = string.format([[
query = string.format([[
CREATE TABLE sbtest%d(
id %s,
k INTEGER,
c VARCHAR,
pad VARCHAR,
%s (id)
) %s %s]],
table_num, id_def, id_index_def, engine_def,
sysbench.opt.create_table_options)
table_num, id_def, id_index_def, engine_def,
sysbench.opt.create_table_options)

con:query(query)
con:query(query)
end

if (sysbench.opt.table_size > 0) then
print(string.format("Inserting %d records into 'sbtest%d'",
Expand Down Expand Up @@ -241,13 +244,13 @@ CREATE TABLE sbtest%d(

con:bulk_insert_done()

if sysbench.opt.create_secondary then
if (not sysbench.opt.skip_ddl) and sysbench.opt.create_secondary then
print(string.format("Creating a secondary index on 'sbtest%d'...",
table_num))
con:query(string.format("CREATE INDEX k_%d ON sbtest%d(k)",
table_num, table_num))
end
if sysbench.opt.create_covered_secondary then
if (not sysbench.opt.skip_ddl) and sysbench.opt.create_covered_secondary then
print(string.format("Creating a covered secondary index on 'sbtest%d'...",
table_num))
con:query(string.format("CREATE INDEX ck_%d ON sbtest%d(k) include(id, c, pad)",
Expand Down

0 comments on commit ed8fd17

Please sign in to comment.