diff --git a/src/Makefile.am b/src/Makefile.am index 72c80ab..2d8cf98 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,7 +50,7 @@ sb_ck_pr.h \ sb_lua.h sb_util.h sb_util.c sb_counter.h sb_counter.c \ lua/internal/sysbench.lua.h lua/internal/sysbench.sql.lua.h \ lua/internal/sysbench.rand.lua.h lua/internal/sysbench.cmdline.lua.h \ -lua/internal/sysbench.compat.lua.h lua/internal/sysbench.histogram.lua.h \ +lua/internal/sysbench.histogram.lua.h \ xoroshiro128plus.h sysbench_LDADD = tests/fileio/libsbfileio.a tests/threads/libsbthreads.a \ diff --git a/src/lua/bulk_insert.lua b/src/lua/bulk_insert.lua index dec9dd1..f074603 100755 --- a/src/lua/bulk_insert.lua +++ b/src/lua/bulk_insert.lua @@ -30,7 +30,7 @@ end function event() if (cursize == 0) then - con:bulk_insert_init("INSERT INTO sbtest" .. thread_id+1 .. " VALUES") + con:bulk_insert_init("INSERT INTO sbtest" .. sysbench.tid+1 .. " VALUES") end cursize = cursize + 1 @@ -38,7 +38,7 @@ function event() con:bulk_insert_next("(" .. cursize .. "," .. cursize .. ")") end -function thread_done(thread_9d) +function thread_done() con:bulk_insert_done() con:disconnect() end diff --git a/src/lua/internal/Makefile.am b/src/lua/internal/Makefile.am index 9624d22..278a071 100644 --- a/src/lua/internal/Makefile.am +++ b/src/lua/internal/Makefile.am @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA BUILT_SOURCES = sysbench.lua.h sysbench.rand.lua.h sysbench.sql.lua.h \ - sysbench.compat.lua.h sysbench.cmdline.lua.h \ + sysbench.cmdline.lua.h \ sysbench.histogram.lua.h CLEANFILES = $(BUILT_SOURCES) diff --git a/src/lua/internal/sysbench.compat.lua b/src/lua/internal/sysbench.compat.lua deleted file mode 100644 index f68c8a1..0000000 --- a/src/lua/internal/sysbench.compat.lua +++ /dev/null @@ -1,75 +0,0 @@ --- Copyright (C) 2016-2017 Alexey Kopytov - --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 2 of the License, or --- (at your option) any later version. - --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. - --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - --- ---------------------------------------------------------------------- --- Compatibility wrappers/aliases. These may be removed in later versions --- ---------------------------------------------------------------------- - -thread_id = sysbench.tid - -test = sysbench.cmdline.script_path - -function sb_rnd() - -- Keep lower 32 bits from sysbench.rand.uniform_uint64() and convert them to - -- a Lua number - return tonumber(sysbench.rand.uniform_uint64() % 4294967296) -end - -sb_rand = sysbench.rand.default -sb_rand_str = sysbench.rand.string -sb_rand_uniform = sysbench.rand.uniform -sb_rand_gaussian = sysbench.rand.gaussian -sb_rand_special = sysbench.rand.special - -function sb_rand_uniq(a, b) - local res - if type(a) == "nil" then - a = 0 - end - if type(b) == "nil" then - b = 4294967295 - end - repeat - res = sysbench.rand.unique() - until res >= a and res <= b - return res -end - -db_connect = sysbench.db.connect -db_disconnect = sysbench.db.disconnect - -db_query = sysbench.db.query - -db_bulk_insert_init = sysbench.db.bulk_insert_init -db_bulk_insert_next = sysbench.db.bulk_insert_next -db_bulk_insert_done = sysbench.db.bulk_insert_done - -db_prepare = sysbench.db.prepare -db_bind_param = sysbench.db.bind_param -db_bind_result = sysbench.db.bind_result -db_execute = sysbench.db.execute - -db_store_results = sysbench.db.store_results -db_free_results = sysbench.db.free_results - -db_close = sysbench.db.close - -DB_ERROR_NONE = sysbench.db.DB_ERROR_NONE -DB_ERROR_RESTART_TRANSACTION = sysbench.db.DB_ERROR_RESTART_TRANSACTION -DB_ERROR_FAILED = sysbench.db.DB_ERROR_FAILED - -mysql_table_engine = mysql_table_engine or "innodb" -myisam_max_rows = 1000000 diff --git a/src/lua/oltp_common.lua b/src/lua/oltp_common.lua index 29dec28..d07a29a 100644 --- a/src/lua/oltp_common.lua +++ b/src/lua/oltp_common.lua @@ -221,12 +221,13 @@ CREATE TABLE sbtest%d( if (sysbench.opt.auto_inc) then query = string.format("(%d, '%s', '%s')", - sb_rand(1, sysbench.opt.table_size), c_val, - pad_val) + sysbench.rand.default(1, sysbench.opt.table_size), + c_val, pad_val) else query = string.format("(%d, %d, '%s', '%s')", - i, sb_rand(1, sysbench.opt.table_size), c_val, - pad_val) + i, + sysbench.rand.default(1, sysbench.opt.table_size), + c_val, pad_val) end con:bulk_insert_next(query) diff --git a/src/lua/select_random_points.lua b/src/lua/select_random_points.lua index a16ce69..827a14a 100755 --- a/src/lua/select_random_points.lua +++ b/src/lua/select_random_points.lua @@ -65,7 +65,7 @@ function event() for i = 1, sysbench.opt.random_points do local rmin = rlen * thread_id local rmax = rmin + rlen - params[i]:set(sb_rand(rmin, rmax)) + params[i]:set(sysbench.rand.default(rmin, rmax)) end stmt:execute() diff --git a/src/lua/select_random_ranges.lua b/src/lua/select_random_ranges.lua index 6c12add..a941eda 100755 --- a/src/lua/select_random_ranges.lua +++ b/src/lua/select_random_ranges.lua @@ -68,7 +68,7 @@ function event() for i = 1, sysbench.opt.number_of_ranges*2, 2 do local rmin = rlen * thread_id local rmax = rmin + rlen - local val = sb_rand(rmin, rmax) + local val = sysbench.rand.default(rmin, rmax) params[i]:set(val) params[i+1]:set(val + sysbench.opt.delta) end diff --git a/src/sb_lua.c b/src/sb_lua.c index 30df7a6..4203b09 100644 --- a/src/sb_lua.c +++ b/src/sb_lua.c @@ -45,7 +45,6 @@ */ #include "lua/internal/sysbench.lua.h" #include "lua/internal/sysbench.cmdline.lua.h" -#include "lua/internal/sysbench.compat.lua.h" #include "lua/internal/sysbench.rand.lua.h" #include "lua/internal/sysbench.sql.lua.h" #include "lua/internal/sysbench.histogram.lua.h" @@ -80,21 +79,6 @@ typedef struct { char is_null; } sb_lua_bind_t; -typedef struct { - db_result_t *ptr; -} sb_lua_db_rs_t; - -typedef struct { - db_stmt_t *ptr; - sb_lua_bind_t *params; - unsigned int nparams; - sb_lua_bind_t *results; - unsigned int nresults; - int param_ref; - int result_ref; - sb_lua_db_rs_t *rs; -} sb_lua_db_stmt_t; - typedef struct { const char *name; const unsigned char *source; @@ -122,7 +106,6 @@ static TLS sb_lua_ctxt_t tls_lua_ctxt CK_CC_CACHELINE; static internal_script_t internal_scripts[] = { {"sysbench.rand.lua", sysbench_rand_lua, &sysbench_rand_lua_len}, {"sysbench.lua", sysbench_lua, &sysbench_lua_len}, - {"sysbench.compat.lua", sysbench_compat_lua, &sysbench_compat_lua_len}, {"sysbench.cmdline.lua", sysbench_cmdline_lua, &sysbench_cmdline_lua_len}, {"sysbench.sql.lua", sysbench_sql_lua, &sysbench_sql_lua_len}, {"sysbench.histogram.lua", sysbench_histogram_lua, @@ -164,23 +147,6 @@ static lua_State *sb_lua_new_state(void); /* Close interpretet state */ static int sb_lua_close_state(lua_State *); -/* Exported C functions for legacy Lua API */ -static int sb_lua_db_connect(lua_State *); -static int sb_lua_db_disconnect(lua_State *); -static int sb_lua_db_query(lua_State *); -static int sb_lua_db_bulk_insert_init(lua_State *); -static int sb_lua_db_bulk_insert_next(lua_State *); -static int sb_lua_db_bulk_insert_done(lua_State *); -static int sb_lua_db_prepare(lua_State *); -static int sb_lua_db_bind_param(lua_State *); -static int sb_lua_db_bind_result(lua_State *); -static int sb_lua_db_execute(lua_State *); -static int sb_lua_db_close(lua_State *); -static int sb_lua_db_store_results(lua_State *); -static int sb_lua_db_free_results(lua_State *); - -static unsigned int sb_lua_table_size(lua_State *, int); - static int read_cmdline_options(lua_State *L); static bool sb_lua_hook_defined(lua_State *, const char *); static bool sb_lua_hook_push(lua_State *, const char *); @@ -204,12 +170,6 @@ static void report_error(lua_State *L) lua_pop(L, 1); } -static void check_connection(lua_State *L, sb_lua_ctxt_t *ctxt) -{ - if (ctxt->con == NULL) - luaL_error(L, "Uninitialized database connection"); -} - static bool func_available(lua_State *L, const char *func) { lua_getglobal(L, func); @@ -314,9 +274,7 @@ static int do_export_options(lua_State *L, bool global) } /* - Export option values to the 'sysbench.opt' table. If the script does not - declare supported options with sysbench.cmdline.options also export to the - global namespace for compatibility with the legacy API. + Export option values to the 'sysbench.opt' table. */ static int export_options(lua_State *L) @@ -324,9 +282,6 @@ static int export_options(lua_State *L) if (do_export_options(L, false)) return 1; - if (sbtest.args == NULL && do_export_options(L, true)) - return 1; - return 0; } @@ -552,13 +507,6 @@ static void sb_lua_var_number(lua_State *L, const char *name, lua_Number n) lua_settable(L, -3); } -static void sb_lua_var_func(lua_State *L, const char *name, lua_CFunction f) -{ - lua_pushstring(L, name); - lua_pushcfunction(L, f); - lua_settable(L, -3); -} - static void sb_lua_var_string(lua_State *L, const char *name, const char *s) { lua_pushstring(L, name); @@ -717,31 +665,6 @@ static lua_State *sb_lua_new_state(void) /* sysbench.tid */ sb_lua_var_number(L, "tid", sb_tls_thread_id); - /* Export functions into per-state 'sysbench.db' table */ - - lua_pushliteral(L, "db"); - lua_newtable(L); - - sb_lua_var_func(L, "connect", sb_lua_db_connect); - sb_lua_var_func(L, "disconnect", sb_lua_db_disconnect); - sb_lua_var_func(L, "query", sb_lua_db_query); - sb_lua_var_func(L, "bulk_insert_init", sb_lua_db_bulk_insert_init); - sb_lua_var_func(L, "bulk_insert_next", sb_lua_db_bulk_insert_next); - sb_lua_var_func(L, "bulk_insert_done", sb_lua_db_bulk_insert_done); - sb_lua_var_func(L, "prepare", sb_lua_db_prepare); - sb_lua_var_func(L, "bind_param", sb_lua_db_bind_param); - sb_lua_var_func(L, "bind_result", sb_lua_db_bind_result); - sb_lua_var_func(L, "execute", sb_lua_db_execute); - sb_lua_var_func(L, "close", sb_lua_db_close); - sb_lua_var_func(L, "store_results", sb_lua_db_store_results); - sb_lua_var_func(L, "free_results", sb_lua_db_free_results); - - sb_lua_var_number(L, "DB_ERROR_NONE", DB_ERROR_NONE); - sb_lua_var_number(L, "DB_ERROR_RESTART_TRANSACTION", DB_ERROR_IGNORABLE); - sb_lua_var_number(L, "DB_ERROR_FAILED", DB_ERROR_FATAL); - - lua_settable(L, -3); /* sysbench.db */ - lua_pushliteral(L, "error"); lua_newtable(L); @@ -837,17 +760,7 @@ int sb_lua_close_state(lua_State *state) lua_close(state); if (ctxt != NULL) - { - sb_lua_db_disconnect(state); - - if (ctxt->driver != NULL) - { - db_destroy(ctxt->driver); - ctxt->driver = NULL; - } - } - - ctxt->L = NULL; + ctxt->L = NULL; return 0; } @@ -892,473 +805,6 @@ int sb_lua_cmd_help(void) return execute_command(HELP_FUNC); } - -int sb_lua_db_connect(lua_State *L) -{ - sb_lua_ctxt_t * const ctxt = &tls_lua_ctxt; - - ctxt->driver = db_create(NULL); - if (ctxt->driver == NULL) - { - luaL_error(L, "DB initialization failed"); - } - - lua_pushstring(L, ctxt->driver->sname); - lua_setglobal(L, "db_driver"); - - if (ctxt->con != NULL) - return 0; - - ctxt->con = db_connection_create(ctxt->driver); - if (ctxt->con == NULL) - luaL_error(L, "Failed to connect to the database"); - - return 0; -} - -int sb_lua_db_disconnect(lua_State *L) -{ - (void) L; /* unused */ - - if (tls_lua_ctxt.con) - { - db_connection_close(tls_lua_ctxt.con); - db_connection_free(tls_lua_ctxt.con); - - tls_lua_ctxt.con = NULL; - } - - return 0; -} - -/* - Throw an error with the { errcode = RESTART_EVENT } table. This will make - thread_run() restart the event. -*/ - -static void throw_restart_event(lua_State *L) -{ - log_text(LOG_DEBUG, "Ignored error encountered, restarting transaction"); - - lua_createtable(L, 0, 1); - lua_pushliteral(L, "errcode"); - lua_pushnumber(L, SB_LUA_ERROR_RESTART_EVENT); - lua_settable(L, -3); - - lua_error(L); /* this call never returns */ -} - -int sb_lua_db_query(lua_State *L) -{ - const char *query; - db_result_t *rs; - size_t len; - - if (tls_lua_ctxt.con == NULL) - sb_lua_db_connect(L); - - db_conn_t * const con = tls_lua_ctxt.con; - - query = luaL_checklstring(L, 1, &len); - rs = db_query(con, query, len); - if (rs == NULL) - { - if (con->error == DB_ERROR_IGNORABLE) - throw_restart_event(L); - else if (con->error == DB_ERROR_FATAL) - luaL_error(L, "db_query() failed"); - } - - if (rs != NULL) - db_free_results(rs); - - return 0; -} - -int sb_lua_db_bulk_insert_init(lua_State *L) -{ - const char *query; - size_t len; - - if (tls_lua_ctxt.con == NULL) - sb_lua_db_connect(L); - - query = luaL_checklstring(L, 1, &len); - if (db_bulk_insert_init(tls_lua_ctxt.con, query, len)) - luaL_error(L, "db_bulk_insert_init() failed"); - - return 0; -} - -int sb_lua_db_bulk_insert_next(lua_State *L) -{ - const char *query; - size_t len; - - check_connection(L, &tls_lua_ctxt); - - query = luaL_checklstring(L, 1, &len); - if (db_bulk_insert_next(tls_lua_ctxt.con, query, len)) - luaL_error(L, "db_bulk_insert_next() failed"); - - return 0; -} - -int sb_lua_db_bulk_insert_done(lua_State *L) -{ - check_connection(L, &tls_lua_ctxt); - - db_bulk_insert_done(tls_lua_ctxt.con); - - return 0; -} - -int sb_lua_db_prepare(lua_State *L) -{ - sb_lua_db_stmt_t *stmt; - const char *query; - size_t len; - - if (tls_lua_ctxt.con == NULL) - sb_lua_db_connect(L); - - query = luaL_checklstring(L, 1, &len); - - stmt = (sb_lua_db_stmt_t *)lua_newuserdata(L, sizeof(sb_lua_db_stmt_t)); - luaL_getmetatable(L, "sysbench.stmt"); - lua_setmetatable(L, -2); - memset(stmt, 0, sizeof(sb_lua_db_stmt_t)); - - stmt->ptr = db_prepare(tls_lua_ctxt.con, query, len); - if (stmt->ptr == NULL) - luaL_error(L, "db_prepare() failed"); - - stmt->param_ref = LUA_REFNIL; - - return 1; -} - -int sb_lua_db_bind_param(lua_State *L) -{ - sb_lua_db_stmt_t *stmt; - unsigned int i, n; - db_bind_t *binds; - char needs_rebind = 0; - - check_connection(L, &tls_lua_ctxt); - - stmt = (sb_lua_db_stmt_t *)luaL_checkudata(L, 1, "sysbench.stmt"); - luaL_argcheck(L, stmt != NULL, 1, "prepared statement expected"); - - if (!lua_istable(L, 2)) - luaL_error(L, "table was expected"); - /* Get table size */ - n = sb_lua_table_size(L, 2); - if (!n) - luaL_error(L, "table is empty"); - binds = (db_bind_t *)calloc(n, sizeof(db_bind_t)); - stmt->params = (sb_lua_bind_t *)calloc(n, sizeof(sb_lua_bind_t)); - if (binds == NULL || stmt->params == NULL) - luaL_error(L, "memory allocation failure"); - - lua_pushnil(L); - for (i = 0; i < n; i++) - { - lua_next(L, 2); - switch(lua_type(L, -1)) - { - case LUA_TNUMBER: - stmt->params[i].buf = malloc(sizeof(int)); - stmt->params[i].id = luaL_checknumber(L, -2); - binds[i].type = DB_TYPE_INT; - binds[i].buffer = stmt->params[i].buf; - break; - case LUA_TSTRING: - stmt->params[i].id = luaL_checknumber(L, -2); - stmt->params[i].buflen = 0; - binds[i].type = DB_TYPE_CHAR; - needs_rebind = 1; - break; - default: - lua_pushfstring(L, "Unsupported variable type: %s", - lua_typename(L, lua_type(L, -1))); - goto error; - } - binds[i].is_null = &stmt->params[i].is_null; - stmt->params[i].type = binds[i].type; - lua_pop(L, 1); - } - - if (!needs_rebind && db_bind_param(stmt->ptr, binds, n)) - goto error; - - stmt->nparams = n; - - /* Create reference for the params table */ - lua_pushvalue(L, 2); - stmt->param_ref = luaL_ref(L, LUA_REGISTRYINDEX); - - free(binds); - - return 0; - - error: - - free(binds); - lua_error(L); - - return 0; -} - -int sb_lua_db_bind_result(lua_State *L) -{ - sb_lua_db_stmt_t *stmt; - unsigned int i, n; - db_bind_t *binds; - char needs_rebind = 0; - - check_connection(L, &tls_lua_ctxt); - - stmt = (sb_lua_db_stmt_t *)luaL_checkudata(L, 1, "sysbench.stmt"); - luaL_argcheck(L, stmt != NULL, 1, "prepared statement expected"); - - if (!lua_istable(L, 2)) - luaL_error(L, "table was expected"); - /* Get table size */ - n = sb_lua_table_size(L, 2); - if (!n) - luaL_error(L, "table is empty"); - binds = (db_bind_t *)calloc(n, sizeof(db_bind_t)); - stmt->results = (sb_lua_bind_t *)calloc(n, sizeof(sb_lua_bind_t)); - if (binds == NULL || stmt->results == NULL) - luaL_error(L, "memory allocation failure"); - - lua_pushnil(L); - for (i = 0; i < n; i++) - { - lua_next(L, 2); - switch(lua_type(L, -1)) - { - case LUA_TNUMBER: - stmt->results[i].buf = malloc(sizeof(int)); - stmt->results[i].id = luaL_checknumber(L, -2); - binds[i].type = DB_TYPE_BIGINT; - binds[i].buffer = stmt->results[i].buf; - break; - case LUA_TSTRING: - stmt->results[i].id = luaL_checknumber(L, -2); - binds[i].type = DB_TYPE_CHAR; - needs_rebind = 1; - break; - default: - lua_pushfstring(L, "Unsupported variable type: %s", - lua_typename(L, lua_type(L, -1))); - goto error; - } - binds[i].is_null = &stmt->results[i].is_null; - stmt->results[i].type = binds[i].type; - lua_pop(L, 1); - } - - if (!needs_rebind && db_bind_result(stmt->ptr, binds, n)) - goto error; - - stmt->nresults = n; - - /* Create reference for the params table */ - lua_pushvalue(L, 2); - stmt->result_ref = luaL_ref(L, LUA_REGISTRYINDEX); - - // free(binds); - - return 0; - - error: - - free(binds); - lua_error(L); - - return 0; -} - -int sb_lua_db_execute(lua_State *L) -{ - sb_lua_db_stmt_t *stmt; - db_result_t *ptr; - sb_lua_db_rs_t *rs; - unsigned int i; - char needs_rebind = 0; - db_bind_t *binds; - size_t length; - const char *str; - sb_lua_bind_t *param; - - check_connection(L, &tls_lua_ctxt); - - stmt = (sb_lua_db_stmt_t *)luaL_checkudata(L, 1, "sysbench.stmt"); - luaL_argcheck(L, stmt != NULL, 1, "prepared statement expected"); - - /* Get params table */ - lua_rawgeti(L, LUA_REGISTRYINDEX, stmt->param_ref); - if (!lua_isnil(L, -1) && !lua_istable(L, -1)) - luaL_error(L, "table expected"); - - for (i = 0; i < stmt->nparams; lua_pop(L, 1), i++) - { - param = stmt->params + i; - lua_pushnumber(L, param->id); - lua_gettable(L, -2); - if (lua_isnil(L, -1)) - { - param->is_null = 1; - continue; - } - param->is_null = 0; - switch (param->type) - { - case DB_TYPE_INT: - *((int *)param->buf) = luaL_checknumber(L, -1); - break; - case DB_TYPE_CHAR: - str = luaL_checkstring(L, -1); - length = lua_objlen(L, -1); - if (length > param->buflen) - { - param->buf = realloc(param->buf, length); - needs_rebind = 1; - } - strncpy(param->buf, str, length); - param->buflen = length; - break; - default: - luaL_error(L, "Unsupported variable type: %s", - lua_typename(L, lua_type(L, -1))); - } - } - - /* Rebind if needed */ - if (needs_rebind) - { - binds = (db_bind_t *)calloc(stmt->nparams, sizeof(db_bind_t)); - if (binds == NULL) - luaL_error(L, "Memory allocation failure"); - - for (i = 0; i < stmt->nparams; i++) - { - param = stmt->params + i; - binds[i].type = param->type; - binds[i].is_null = ¶m->is_null; - if (*binds[i].is_null != 0) - continue; - switch (param->type) - { - case DB_TYPE_INT: - binds[i].buffer = param->buf; - break; - case DB_TYPE_CHAR: - binds[i].buffer = param->buf; - binds[i].data_len = &stmt->params[i].buflen; - binds[i].is_null = 0; - break; - default: - luaL_error(L, "Unsupported variable type"); - } - } - - if (db_bind_param(stmt->ptr, binds, stmt->nparams)) - luaL_error(L, "db_bind_param() failed"); - free(binds); - } - - ptr = db_execute(stmt->ptr); - if (ptr == NULL && tls_lua_ctxt.con->error == DB_ERROR_IGNORABLE) - { - stmt->rs = NULL; - throw_restart_event(L); - } - else - { - rs = (sb_lua_db_rs_t *)lua_newuserdata(L, sizeof(sb_lua_db_rs_t)); - rs->ptr = ptr; - luaL_getmetatable(L, "sysbench.rs"); - lua_setmetatable(L, -2); - stmt->rs = rs; - } - - return 1; -} - -int sb_lua_db_close(lua_State *L) -{ - sb_lua_db_stmt_t *stmt; - unsigned int i; - - check_connection(L, &tls_lua_ctxt); - - stmt = (sb_lua_db_stmt_t *)luaL_checkudata(L, 1, "sysbench.stmt"); - luaL_argcheck(L, stmt != NULL, 1, "prepared statement expected"); - - for (i = 0; i < stmt->nparams; i++) - { - if (stmt->params[i].buf != NULL) - free(stmt->params[i].buf); - } - free(stmt->params); - stmt->params = NULL; - - luaL_unref(L, LUA_REGISTRYINDEX, stmt->param_ref); - luaL_unref(L, LUA_REGISTRYINDEX, stmt->result_ref); - - db_close(stmt->ptr); - - return 0; -} - -int sb_lua_db_store_results(lua_State *L) -{ - sb_lua_db_rs_t *rs; - - check_connection(L, &tls_lua_ctxt); - - rs = (sb_lua_db_rs_t *)luaL_checkudata(L, 1, "sysbench.rs"); - luaL_argcheck(L, rs != NULL, 1, "result set expected"); - - /* noop as db_store_results() is now performed automatically by db_query() */ - - return 0; -} - -int sb_lua_db_free_results(lua_State *L) -{ - sb_lua_db_rs_t *rs; - - check_connection(L, &tls_lua_ctxt); - - rs = (sb_lua_db_rs_t *)luaL_checkudata(L, 1, "sysbench.rs"); - luaL_argcheck(L, rs != NULL, 1, "result set expected"); - - if (rs->ptr != NULL) - { - db_free_results(rs->ptr); - rs->ptr = NULL; - } - - return 0; -} - -unsigned int sb_lua_table_size(lua_State *L, int index) -{ - unsigned int i; - - lua_pushnil(L); - for (i = 0; lua_next(L, index); i++) - { - lua_pop(L, 1); - } - - return i; -} - /* Check if a specified hook exists */ static bool sb_lua_hook_defined(lua_State *L, const char *name) diff --git a/src/sysbench.c b/src/sysbench.c index 7865fb5..7bc7f67 100644 --- a/src/sysbench.c +++ b/src/sysbench.c @@ -1,5 +1,5 @@ /* Copyright (C) 2004 MySQL AB - Copyright (C) 2004-2017 Alexey Kopytov + Copyright (C) 2004-2018 Alexey Kopytov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -617,12 +617,8 @@ static int parse_test_arguments(sb_test_t *test, int argc, char *argv[]) if (argv[i] == NULL || strncmp(argv[i], "--", 2)) continue; - /* - At this stage an unrecognized option must throw a error, unless the test - defines no options (for compatibility with legacy Lua scripts). In the - latter case we just export all unrecognized options as strings. - */ - if (parse_option(argv[i]+2, test->args == NULL)) + /* At this stage an unrecognized option must throw a error. */ + if (parse_option(argv[i]+2, false)) { fprintf(stderr, "invalid option: %s\n", argv[i]); return 1; diff --git a/tests/Makefile.am b/tests/Makefile.am index c003260..ae2a703 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2016 Alexey Kopytov +# Copyright (C) 2016-2018 Alexey Kopytov # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ EXTRA_DIST = $(test_SCRIPTS) \ testroot = $(datadir) testdir = $(testroot)/sysbench/tests -test_dirs= t include include/oltp_legacy +test_dirs= t include # Used by dist-hook and install-data-local to copy all # test files into either dist or install directory diff --git a/tests/include/drv_common.sh b/tests/include/drv_common.sh index cd1b255..c6ff2b4 100644 --- a/tests/include/drv_common.sh +++ b/tests/include/drv_common.sh @@ -10,7 +10,8 @@ set -eu cat >test.lua < then - > exit 80 - > fi - - $ SB_ARGS="--verbosity=0 --max-requests=2 --db-driver=mysql $SBTEST_MYSQL_ARGS --test=$CRAMTMP/api_legacy_basic.lua" - - $ cat >$CRAMTMP/api_legacy_basic.lua < function prepare(thread_id) - > print("tid:" .. (thread_id or "(nil)") .. " prepare()") - > end - > - > function run(thread_id) - > print("tid:" .. (thread_id or "(nil)") .. " run()") - > end - > - > function cleanup(thread_id) - > print("tid:" .. (thread_id or "(nil)") .. " cleanup()") - > end - > - > function help() - > print("tid:" .. (thread_id or "(nil)") .. " help()") - > end - > - > function thread_init(thread_id) - > print(string.format("tid:%d thread_init()", thread_id)) - > end - > - > function event(thread_id) - > print(string.format("tid:%d event()", thread_id)) - > end - > - > function thread_done(thread_id) - > print(string.format("tid:%d thread_done()", thread_id)) - > end - > - > EOF - - $ sysbench $SB_ARGS prepare - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - tid:(nil) prepare() - - $ sysbench $SB_ARGS run - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - tid:0 thread_init() - tid:0 event() - tid:0 event() - tid:0 thread_done() - - $ sysbench $SB_ARGS cleanup - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - tid:(nil) cleanup() - - $ sysbench $SB_ARGS help - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - tid:0 help() - - $ cat >$CRAMTMP/api_legacy_basic.lua < function prepare() - > print(test) - > end - > EOF - $ sysbench $SB_ARGS prepare - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - */api_legacy_basic.lua (glob) diff --git a/tests/t/api_legacy_rand.t b/tests/t/api_legacy_rand.t deleted file mode 100644 index 026e283..0000000 --- a/tests/t/api_legacy_rand.t +++ /dev/null @@ -1,47 +0,0 @@ -######################################################################## -Legacy PRNG Lua API tests -######################################################################## - - $ SB_ARGS="--verbosity=0 --max-requests=1" - - $ cat >$CRAMTMP/api_legacy_rand.lua < function event() - > print("sb_rand(0, 9) = " .. sb_rand(0, 9)) - > print("sb_rand_uniq(0, 4294967295) = " .. sb_rand_uniq(0, 4294967295)) - > print("sb_rnd() = " .. sb_rnd()) - > print([[sb_rand_str("abc-###-@@@-xyz") = ]] .. sb_rand_str("abc-###-@@@-xyz")) - > print("sb_rand_uniform(0, 9) = " .. sb_rand_uniform(0, 9)) - > print("sb_rand_gaussian(0, 9) = " .. sb_rand_gaussian(0, 9)) - > print("sb_rand_special(0, 9) = " .. sb_rand_special(0, 9)) - > end - > EOF - - $ sysbench $SB_ARGS --test=$CRAMTMP/api_legacy_rand.lua run - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - sb_rand\(0, 9\) = [0-9]{1} (re) - sb_rand_uniq\(0, 4294967295\) = [0-9]{1,10} (re) - sb_rnd\(\) = [0-9]+ (re) - sb_rand_str\(".*"\) = abc-[0-9]{3}-[a-z]{3}-xyz (re) - sb_rand_uniform\(0, 9\) = [0-9]{1} (re) - sb_rand_gaussian\(0, 9\) = [0-9]{1} (re) - sb_rand_special\(0, 9\) = [0-9]{1} (re) - -######################################################################## -GH-96: sb_rand_uniq(1, oltp_table_size) generate duplicate value -######################################################################## - $ cat >$CRAMTMP/api_rand_uniq.lua < function event() - > local max = 1000000000 - > local n = sb_rand_uniq(1, max) - > if n > max then - > error("n is out of range") - > end - > print(n) - > end - > EOF - - $ sysbench $SB_ARGS --max-requests=100000 --test=$CRAMTMP/api_rand_uniq.lua run | - > grep -v WARNING | sort -n | uniq | wc -l | sed -e 's/ //g' - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - 100000 diff --git a/tests/t/api_legacy_sql.t b/tests/t/api_legacy_sql.t deleted file mode 100644 index f236ecc..0000000 --- a/tests/t/api_legacy_sql.t +++ /dev/null @@ -1,447 +0,0 @@ -######################################################################## -Legacy SQL Lua API tests -######################################################################## - - $ if [ -z "${SBTEST_MYSQL_ARGS:-}" ] - > then - > exit 80 - > fi - - $ SB_ARGS="--verbosity=1 --max-requests=1 --db-driver=mysql $SBTEST_MYSQL_ARGS --test=$CRAMTMP/api_legacy_sql.lua" - $ cat >$CRAMTMP/api_legacy_sql.lua < function event(thread_id) - > db_query("CREATE TABLE t(a INT)") - > - > db_bulk_insert_init("INSERT INTO t VALUES") - > for i = 1,100 do - > db_bulk_insert_next(string.format("(%d)", i)) - > end - > db_bulk_insert_done() - > - > db_connect() - > db_query("SELECT 1") - > db_disconnect() - > db_query("SELECT 1") - > db_connect() - > - > local stmt = db_prepare("UPDATE t SET a = a + ?") - > db_bind_param(stmt, {100}) - > rs = db_execute(stmt) - > db_store_results(rs) - > db_free_results(rs) - > db_close(stmt) - > - > print("DB_ERROR_NONE = " .. DB_ERROR_NONE) - > print("DB_ERROR_RESTART_TRANSACTION = " .. DB_ERROR_RESTART_TRANSACTION) - > print("DB_ERROR_FAILED = " .. DB_ERROR_FAILED) - > end - > EOF - - $ mysql -uroot sbtest -Nse "DROP TABLE IF EXISTS t" - - $ sysbench $SB_ARGS run - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --max-requests is deprecated, use --events instead - DB_ERROR_NONE = [0-9] (re) - DB_ERROR_RESTART_TRANSACTION = [0-9] (re) - DB_ERROR_FAILED = [0-9] (re) - - $ mysql -uroot sbtest -Nse "SHOW CREATE TABLE t\G" - *************************** 1. row *************************** - t - CREATE TABLE `t` ( - `a` int(11) DEFAULT NULL - ) * (glob) - - $ mysql -uroot sbtest -Nse "SELECT COUNT(DISTINCT a) FROM t" - 100 - - $ mysql -uroot sbtest -Nse "SELECT MIN(a), MAX(a) FROM t\G" - *************************** 1. row *************************** - 101 - 200 - - $ mysql -uroot sbtest -Nse "DROP TABLE t" - - $ function db_show_table() { - > mysql -uroot sbtest -Nse "SHOW CREATE TABLE $1\G" - > } - - $ DB_DRIVER_ARGS="--db-driver=mysql --mysql-table-engine=myisam $SBTEST_MYSQL_ARGS" - $ . $SBTEST_INCDIR/script_oltp_legacy_common.sh - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench *.* * (glob) - - Creating table 'sbtest1'... - Inserting 10000 records into 'sbtest1' - Creating secondary indexes on 'sbtest1'... - Creating table 'sbtest2'... - Inserting 10000 records into 'sbtest2' - Creating secondary indexes on 'sbtest2'... - Creating table 'sbtest3'... - Inserting 10000 records into 'sbtest3' - Creating secondary indexes on 'sbtest3'... - Creating table 'sbtest4'... - Inserting 10000 records into 'sbtest4' - Creating secondary indexes on 'sbtest4'... - Creating table 'sbtest5'... - Inserting 10000 records into 'sbtest5' - Creating secondary indexes on 'sbtest5'... - Creating table 'sbtest6'... - Inserting 10000 records into 'sbtest6' - Creating secondary indexes on 'sbtest6'... - Creating table 'sbtest7'... - Inserting 10000 records into 'sbtest7' - Creating secondary indexes on 'sbtest7'... - Creating table 'sbtest8'... - Inserting 10000 records into 'sbtest8' - Creating secondary indexes on 'sbtest8'... - *************************** 1. row *************************** - sbtest1 - CREATE TABLE `sbtest1` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_1` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest2 - CREATE TABLE `sbtest2` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_2` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest3 - CREATE TABLE `sbtest3` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_3` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest4 - CREATE TABLE `sbtest4` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_4` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest5 - CREATE TABLE `sbtest5` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_5` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest6 - CREATE TABLE `sbtest6` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_6` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest7 - CREATE TABLE `sbtest7` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_7` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest8 - CREATE TABLE `sbtest8` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_8` (`k`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest9' doesn't exist - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --num-threads is deprecated, use --threads instead - WARNING: --max-requests is deprecated, use --events instead - sysbench *.* * (glob) - - Running the test with following options: - Number of threads: 2 - Initializing random number generator from current time - - - Initializing worker threads... - - Threads started! - - SQL statistics: - queries performed: - read: 1400 - write: 400 - other: 200 - total: 2000 - transactions: 100 (* per sec.) (glob) - queries: 2000 (* per sec.) (glob) - ignored errors: 0 (* per sec.) (glob) - reconnects: 0 (* per sec.) (glob) - - Throughput: - events/s (eps): *.* (glob) - time elapsed: *s (glob) - total number of events: 100 - - Latency (ms): - min: *.* (glob) - avg: *.* (glob) - max: *.* (glob) - 95th percentile: *.* (glob) - sum: *.* (glob) - - Threads fairness: - events (avg/stddev): */* (glob) - execution time (avg/stddev): */* (glob) - - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench *.* * (glob) - - Dropping table 'sbtest1'... - Dropping table 'sbtest2'... - Dropping table 'sbtest3'... - Dropping table 'sbtest4'... - Dropping table 'sbtest5'... - Dropping table 'sbtest6'... - Dropping table 'sbtest7'... - Dropping table 'sbtest8'... - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest1' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest2' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest3' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest4' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest5' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench * (glob) - - Creating table 'sbtest1'... - Inserting 10000 records into 'sbtest1' - *************************** 1. row *************************** - sbtest1 - CREATE TABLE `sbtest1` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`) - ) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench * (glob) - - Dropping table 'sbtest1'... - - $ DB_DRIVER_ARGS="--db-driver=mysql --mysql-table-engine=innodb $SBTEST_MYSQL_ARGS" - $ . $SBTEST_INCDIR/script_oltp_legacy_common.sh - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench *.* * (glob) - - Creating table 'sbtest1'... - Inserting 10000 records into 'sbtest1' - Creating secondary indexes on 'sbtest1'... - Creating table 'sbtest2'... - Inserting 10000 records into 'sbtest2' - Creating secondary indexes on 'sbtest2'... - Creating table 'sbtest3'... - Inserting 10000 records into 'sbtest3' - Creating secondary indexes on 'sbtest3'... - Creating table 'sbtest4'... - Inserting 10000 records into 'sbtest4' - Creating secondary indexes on 'sbtest4'... - Creating table 'sbtest5'... - Inserting 10000 records into 'sbtest5' - Creating secondary indexes on 'sbtest5'... - Creating table 'sbtest6'... - Inserting 10000 records into 'sbtest6' - Creating secondary indexes on 'sbtest6'... - Creating table 'sbtest7'... - Inserting 10000 records into 'sbtest7' - Creating secondary indexes on 'sbtest7'... - Creating table 'sbtest8'... - Inserting 10000 records into 'sbtest8' - Creating secondary indexes on 'sbtest8'... - *************************** 1. row *************************** - sbtest1 - CREATE TABLE `sbtest1` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_1` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest2 - CREATE TABLE `sbtest2` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_2` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest3 - CREATE TABLE `sbtest3` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_3` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest4 - CREATE TABLE `sbtest4` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_4` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest5 - CREATE TABLE `sbtest5` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_5` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest6 - CREATE TABLE `sbtest6` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_6` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest7 - CREATE TABLE `sbtest7` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_7` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - *************************** 1. row *************************** - sbtest8 - CREATE TABLE `sbtest8` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`), - KEY `k_8` (`k`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest9' doesn't exist - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - WARNING: --num-threads is deprecated, use --threads instead - WARNING: --max-requests is deprecated, use --events instead - sysbench *.* * (glob) - - Running the test with following options: - Number of threads: 2 - Initializing random number generator from current time - - - Initializing worker threads... - - Threads started! - - SQL statistics: - queries performed: - read: 1400 - write: 400 - other: 200 - total: 2000 - transactions: 100 (* per sec.) (glob) - queries: 2000 (* per sec.) (glob) - ignored errors: 0 (* per sec.) (glob) - reconnects: 0 (* per sec.) (glob) - - Throughput: - events/s (eps): *.* (glob) - time elapsed: *s (glob) - total number of events: 100 - - Latency (ms): - min: *.* (glob) - avg: *.* (glob) - max: *.* (glob) - 95th percentile: *.* (glob) - sum: *.* (glob) - - Threads fairness: - events (avg/stddev): */* (glob) - execution time (avg/stddev): */* (glob) - - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench *.* * (glob) - - Dropping table 'sbtest1'... - Dropping table 'sbtest2'... - Dropping table 'sbtest3'... - Dropping table 'sbtest4'... - Dropping table 'sbtest5'... - Dropping table 'sbtest6'... - Dropping table 'sbtest7'... - Dropping table 'sbtest8'... - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest1' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest2' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest3' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest4' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest5' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest6' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest7' doesn't exist - ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest8' doesn't exist - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench * (glob) - - Creating table 'sbtest1'... - Inserting 10000 records into 'sbtest1' - *************************** 1. row *************************** - sbtest1 - CREATE TABLE `sbtest1` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `k` int(10) unsigned NOT NULL DEFAULT '0', - `c` char(120)* NOT NULL DEFAULT '', (glob) - `pad` char(60)* NOT NULL DEFAULT '', (glob) - PRIMARY KEY (`id`) - ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* MAX_ROWS=1000000 (glob) - WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options. - sysbench * (glob) - - Dropping table 'sbtest1'... - diff --git a/tests/t/cmdline.t b/tests/t/cmdline.t index 277e735..0dc35fa 100644 --- a/tests/t/cmdline.t +++ b/tests/t/cmdline.t @@ -414,6 +414,7 @@ Command line options tests [1] $ cat >cmdline.lua < sysbench.cmdline.options = { opt1 = {"opt1"}, opt2 = {"opt2"} } > function print_cmd() > print("argv = " .. require("inspect")(sysbench.cmdline.argv)) > print(string.format("sysbench.cmdline.command = %s",sysbench.cmdline.command))