diff --git a/src/lua/oltp_common.lua b/src/lua/oltp_common.lua index b38cce8..301bdf9 100644 --- a/src/lua/oltp_common.lua +++ b/src/lua/oltp_common.lua @@ -59,6 +59,8 @@ sysbench.cmdline.options = { {"Use AUTO_INCREMENT column as Primary Key (for MySQL), " .. "or its alternatives in other DBMS. When disabled, use " .. "client-generated IDs", true}, + create_table_options = + {"Extra CREATE TABLE options", ""}, skip_trx = {"Don't start explicit transactions and execute all queries " .. "in the AUTOCOMMIT mode", false}, @@ -169,7 +171,6 @@ function create_table(drv, con, table_num) id_def = "INTEGER NOT NULL" end engine_def = "/*! ENGINE = " .. sysbench.opt.mysql_storage_engine .. " */" - extra_table_options = mysql_table_options or "" elseif drv:name() == "pgsql" then if not sysbench.opt.auto_inc then @@ -193,7 +194,8 @@ CREATE TABLE sbtest%d( pad CHAR(60) DEFAULT '' NOT NULL, %s (id) ) %s %s]], - table_num, id_def, id_index_def, engine_def, extra_table_options) + table_num, id_def, id_index_def, engine_def, + sysbench.opt.create_table_options) con:query(query) diff --git a/tests/t/script_oltp_general_mysql.t b/tests/t/script_oltp_general_mysql.t new file mode 100644 index 0000000..787447a --- /dev/null +++ b/tests/t/script_oltp_general_mysql.t @@ -0,0 +1,23 @@ + $ . $SBTEST_INCDIR/mysql_common.sh + $ SB_EXTRA_ARGS=${SB_EXTRA_ARGS:-} + $ ARGS="oltp_read_write ${DB_DRIVER_ARGS} --verbosity=1 ${SB_EXTRA_ARGS}" + + $ sysbench $ARGS --create-table-options="COMMENT='foo'" prepare + Creating table 'sbtest1'... + Inserting 10000 records into 'sbtest1' + Creating a secondary index on 'sbtest1'... + + $ db_show_table sbtest1 + *************************** 1. row *************************** + sbtest1 + CREATE TABLE `sbtest1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `k` int(11) NOT NULL DEFAULT '0', + `c` char(120) NOT NULL DEFAULT '', + `pad` char(60) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `k_1` (`k`) + ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='foo' + + $ sysbench $ARGS --create-table-options="COMMENT='foo'" cleanup + Dropping table 'sbtest1'... diff --git a/tests/t/script_oltp_help.t b/tests/t/script_oltp_help.t index 3d4fbd9..ef79a38 100644 --- a/tests/t/script_oltp_help.t +++ b/tests/t/script_oltp_help.t @@ -8,6 +8,7 @@ OLTP usage information test oltp_read_write.lua options: --auto_inc[=on|off] Use AUTO_INCREMENT column as Primary Key (for MySQL), or its alternatives in other DBMS. When disabled, use client-generated IDs [on] --create_secondary[=on|off] Create a secondary index in addition to the PRIMARY KEY [on] + --create_table_options=STRING Extra CREATE TABLE options [] --delete_inserts=N Number of DELETE/INSERT combinations per transaction [1] --distinct_ranges=N Number of SELECT DISTINCT queries per transaction [1] --index_updates=N Number of UPDATE index queries per transaction [1]