Rewrite OLTP benchmarks with the new SQL API + cleanups.
This commit is contained in:
@ -17,6 +17,14 @@
|
||||
SUBDIRS = internal
|
||||
|
||||
dist_pkgdata_DATA = bulk_insert.lua \
|
||||
oltp_common.lua oltp.lua \
|
||||
oltp_common.lua \
|
||||
oltp_delete.lua \
|
||||
oltp_insert.lua \
|
||||
oltp_read_only.lua \
|
||||
oltp_read_write.lua \
|
||||
oltp_point_select.lua \
|
||||
select_random_points.lua select_random_ranges.lua
|
||||
oltp_update_index.lua \
|
||||
oltp_update_non_index.lua \
|
||||
oltp_write_only.lua\
|
||||
select_random_points.lua \
|
||||
select_random_ranges.lua
|
||||
|
||||
@ -31,7 +31,14 @@ typedef enum
|
||||
DB_ERROR_FATAL /* non-ignorable error */
|
||||
} sql_error_t;
|
||||
|
||||
typedef struct db_driver sql_driver;
|
||||
typedef struct
|
||||
{
|
||||
const char *sname; /* short name */
|
||||
const char *lname; /* long name */
|
||||
|
||||
const char opaque[?];
|
||||
} sql_driver;
|
||||
|
||||
typedef struct db_conn sql_connection;
|
||||
typedef struct db_stmt sql_statement;
|
||||
typedef struct db_result sql_result;
|
||||
@ -266,15 +273,20 @@ function sysbench.sql.free_results(result)
|
||||
return ffi.C.db_free_results(result)
|
||||
end
|
||||
|
||||
function sysbench.sql.driver_name(driver)
|
||||
return ffi.string(driver.sname)
|
||||
end
|
||||
|
||||
-- sql_driver metatable
|
||||
local driver_mt = {
|
||||
__index = {
|
||||
connect = sysbench.sql.connect,
|
||||
name = sysbench.sql.driver_name,
|
||||
},
|
||||
__gc = ffi.C.db_destroy,
|
||||
__tostring = function() return '<sql_driver>' end,
|
||||
}
|
||||
ffi.metatype("struct db_driver", driver_mt)
|
||||
ffi.metatype("sql_driver", driver_mt)
|
||||
|
||||
-- sql_connection metatable
|
||||
local connection_mt = {
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function thread_init()
|
||||
set_vars()
|
||||
|
||||
if (((db_driver == "mysql") or (db_driver == "attachsql")) and mysql_table_engine == "myisam") then
|
||||
local i
|
||||
local tables = {}
|
||||
for i=1, oltp_tables_count do
|
||||
tables[i] = string.format("sbtest%i WRITE", i)
|
||||
end
|
||||
begin_query = "LOCK TABLES " .. table.concat(tables, " ,")
|
||||
commit_query = "UNLOCK TABLES"
|
||||
else
|
||||
begin_query = "BEGIN"
|
||||
commit_query = "COMMIT"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function get_range_str()
|
||||
local start = sb_rand(1, oltp_table_size)
|
||||
return string.format(" WHERE id BETWEEN %u AND %u",
|
||||
start, start + oltp_range_size - 1)
|
||||
end
|
||||
|
||||
function event()
|
||||
local rs
|
||||
local i
|
||||
local table_name
|
||||
local c_val
|
||||
local pad_val
|
||||
local query
|
||||
|
||||
table_name = "sbtest".. sb_rand_uniform(1, oltp_tables_count)
|
||||
if not oltp_skip_trx then
|
||||
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
|
||||
|
||||
for i=1, oltp_sum_ranges do
|
||||
rs = db_query("SELECT SUM(K) FROM ".. table_name .. get_range_str())
|
||||
end
|
||||
|
||||
for i=1, oltp_order_ranges do
|
||||
rs = db_query("SELECT c FROM ".. table_name .. get_range_str() ..
|
||||
" ORDER BY c")
|
||||
end
|
||||
|
||||
for i=1, oltp_distinct_ranges do
|
||||
rs = db_query("SELECT DISTINCT c FROM ".. table_name .. get_range_str() ..
|
||||
" ORDER BY c")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if not oltp_read_only then
|
||||
|
||||
for i=1, oltp_index_updates do
|
||||
rs = db_query("UPDATE " .. table_name .. " SET k=k+1 WHERE id=" .. sb_rand(1, oltp_table_size))
|
||||
end
|
||||
|
||||
for i=1, oltp_non_index_updates do
|
||||
c_val = sb_rand_str("###########-###########-###########-###########-###########-###########-###########-###########-###########-###########")
|
||||
query = "UPDATE " .. table_name .. " SET c='" .. c_val .. "' WHERE id=" .. sb_rand(1, oltp_table_size)
|
||||
rs = db_query(query)
|
||||
if rs then
|
||||
print(query)
|
||||
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)
|
||||
|
||||
c_val = sb_rand_str([[
|
||||
###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]])
|
||||
pad_val = sb_rand_str([[
|
||||
###########-###########-###########-###########-###########]])
|
||||
|
||||
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
|
||||
db_query(commit_query)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -18,128 +18,209 @@
|
||||
-- Common code for OLTP benchmarks
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
function create_insert(table_id)
|
||||
-- Generate strings of random digits with 11-digit groups separated by dashes
|
||||
local function get_c_value()
|
||||
-- 10 groups, 119 characters
|
||||
return sysbench.rand.string("###########-###########-###########-" ..
|
||||
"###########-###########-###########-" ..
|
||||
"###########-###########-###########-" ..
|
||||
"###########")
|
||||
end
|
||||
|
||||
local index_name
|
||||
local i
|
||||
local j
|
||||
local function get_pad_value()
|
||||
-- 5 groups, 59 characters
|
||||
return sysbench.rand.string("###########-###########-###########-" ..
|
||||
"###########-###########")
|
||||
end
|
||||
|
||||
local function create_table(drv, con, table_num)
|
||||
local id_index_def, id_def
|
||||
local engine_def = ""
|
||||
local extra_table_options = ""
|
||||
local query
|
||||
|
||||
if (oltp_secondary) then
|
||||
index_name = "KEY xid"
|
||||
if oltp_secondary then
|
||||
id_index_def = "KEY xid"
|
||||
else
|
||||
index_name = "PRIMARY KEY"
|
||||
id_index_def = "PRIMARY KEY"
|
||||
end
|
||||
|
||||
if (pgsql_variant == 'redshift') then
|
||||
auto_inc_type = "INTEGER IDENTITY(1,1)"
|
||||
if drv:name() == "mysql" or drv:name() == "attachsql" or
|
||||
drv:name() == "drizzle"
|
||||
then
|
||||
if oltp_auto_inc then
|
||||
id_def = "INTEGER NOT NULL AUTO_INCREMENT"
|
||||
else
|
||||
id_def = "INTEGER NOT NULL"
|
||||
end
|
||||
engine_def = "/*! ENGINE = " .. mysql_table_engine .. " */"
|
||||
extra_table_options = mysql_table_options or ""
|
||||
elseif drv:name() == "pgsql"
|
||||
then
|
||||
if not oltp_auto_inc then
|
||||
id_def = "INTEGER NOT NULL"
|
||||
elseif pgsql_variant == 'redshift' then
|
||||
id_def = "INTEGER IDENTITY(1,1)"
|
||||
else
|
||||
id_def = "SERIAL"
|
||||
end
|
||||
else
|
||||
auto_inc_type = "SERIAL"
|
||||
error("Unsupported database driver:" .. drv:name())
|
||||
end
|
||||
|
||||
i = table_id
|
||||
print(string.format("Creating table 'sbtest%d'...", table_num))
|
||||
|
||||
print("Creating table 'sbtest" .. i .. "'...")
|
||||
if ((db_driver == "mysql") or (db_driver == "attachsql")) then
|
||||
query = [[
|
||||
CREATE TABLE sbtest]] .. i .. [[ (
|
||||
id INTEGER UNSIGNED NOT NULL ]] ..
|
||||
((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[,
|
||||
k INTEGER UNSIGNED DEFAULT '0' NOT NULL,
|
||||
c CHAR(120) DEFAULT '' NOT NULL,
|
||||
pad CHAR(60) DEFAULT '' NOT NULL,
|
||||
]] .. index_name .. [[ (id)
|
||||
) /*! ENGINE = ]] .. mysql_table_engine ..
|
||||
" MAX_ROWS = " .. myisam_max_rows .. " */ " ..
|
||||
(mysql_table_options or "")
|
||||
query = string.format([[
|
||||
CREATE TABLE sbtest%d(
|
||||
id %s,
|
||||
k INTEGER DEFAULT '0' NOT NULL,
|
||||
c CHAR(120) DEFAULT '' NOT NULL,
|
||||
pad CHAR(60) DEFAULT '' NOT NULL,
|
||||
%s (id)
|
||||
) %s %s]],
|
||||
table_num, id_def, id_index_def, engine_def, extra_table_options)
|
||||
|
||||
elseif (db_driver == "pgsql") then
|
||||
query = [[
|
||||
CREATE TABLE sbtest]] .. i .. [[ (
|
||||
id ]] .. auto_inc_type .. [[ NOT NULL,
|
||||
k INTEGER DEFAULT '0' NOT NULL,
|
||||
c CHAR(120) DEFAULT '' NOT NULL,
|
||||
pad CHAR(60) DEFAULT '' NOT NULL,
|
||||
]] .. index_name .. [[ (id)
|
||||
) ]]
|
||||
con:query(query)
|
||||
|
||||
elseif (db_driver == "drizzle") then
|
||||
query = [[
|
||||
CREATE TABLE sbtest (
|
||||
id INTEGER NOT NULL ]] .. ((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[,
|
||||
k INTEGER DEFAULT '0' NOT NULL,
|
||||
c CHAR(120) DEFAULT '' NOT NULL,
|
||||
pad CHAR(60) DEFAULT '' NOT NULL,
|
||||
]] .. index_name .. [[ (id)
|
||||
) ]]
|
||||
print(string.format("Inserting %d records into 'sbtest%d'",
|
||||
oltp_table_size, table_num))
|
||||
|
||||
if oltp_auto_inc then
|
||||
query = "INSERT INTO sbtest" .. table_num .. "(k, c, pad) VALUES"
|
||||
else
|
||||
print("Unknown database driver: " .. db_driver)
|
||||
return 1
|
||||
query = "INSERT INTO sbtest" .. table_num .. "(id, k, c, pad) VALUES"
|
||||
end
|
||||
|
||||
db_query(query)
|
||||
|
||||
print("Inserting " .. oltp_table_size .. " records into 'sbtest" .. i .. "'")
|
||||
|
||||
if (oltp_auto_inc) then
|
||||
db_bulk_insert_init("INSERT INTO sbtest" .. i .. "(k, c, pad) VALUES")
|
||||
else
|
||||
db_bulk_insert_init("INSERT INTO sbtest" .. i .. "(id, k, c, pad) VALUES")
|
||||
end
|
||||
con:bulk_insert_init(query)
|
||||
|
||||
local c_val
|
||||
local pad_val
|
||||
local i
|
||||
|
||||
for i = 1,oltp_table_size do
|
||||
|
||||
for j = 1,oltp_table_size do
|
||||
|
||||
c_val = sb_rand_str([[
|
||||
###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]])
|
||||
pad_val = sb_rand_str([[
|
||||
###########-###########-###########-###########-###########]])
|
||||
c_val = get_c_value()
|
||||
pad_val = get_pad_value()
|
||||
|
||||
if (oltp_auto_inc) then
|
||||
db_bulk_insert_next("(" .. sb_rand(1, oltp_table_size) .. ", '".. c_val .."', '" .. pad_val .. "')")
|
||||
query = string.format("(%d, '%s', '%s')",
|
||||
sb_rand(1, oltp_table_size), c_val, pad_val)
|
||||
else
|
||||
db_bulk_insert_next("("..j.."," .. sb_rand(1, oltp_table_size) .. ",'".. c_val .."', '" .. pad_val .. "' )")
|
||||
query = string.format("(%d, %d, '%s', '%s')",
|
||||
i, sb_rand(1, oltp_table_size), c_val, pad_val)
|
||||
end
|
||||
|
||||
con:bulk_insert_next(query)
|
||||
end
|
||||
|
||||
db_bulk_insert_done()
|
||||
con:bulk_insert_done()
|
||||
|
||||
if oltp_create_secondary then
|
||||
print("Creating secondary indexes on 'sbtest" .. i .. "'...")
|
||||
db_query("CREATE INDEX k_" .. i .. " on sbtest" .. i .. "(k)")
|
||||
print(string.format("Creating secondary indexes on 'sbtest%d'...",
|
||||
table_num))
|
||||
con:query(string.format("CREATE INDEX k_%d ON sbtest%d(k)",
|
||||
table_num, table_num))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function prepare()
|
||||
local query
|
||||
local i
|
||||
local j
|
||||
|
||||
function thread_init()
|
||||
set_vars()
|
||||
|
||||
db_connect()
|
||||
drv = sysbench.sql.driver()
|
||||
con = drv:connect()
|
||||
end
|
||||
|
||||
function prepare()
|
||||
set_vars()
|
||||
|
||||
local drv = sysbench.sql.driver()
|
||||
local con = drv:connect()
|
||||
local i
|
||||
|
||||
for i = 1,oltp_tables_count do
|
||||
create_insert(i)
|
||||
create_table(drv, con, i)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function cleanup()
|
||||
local i
|
||||
|
||||
set_vars()
|
||||
|
||||
local drv = sysbench.sql.driver()
|
||||
local con = drv:connect()
|
||||
local i
|
||||
|
||||
for i = 1,oltp_tables_count do
|
||||
print("Dropping table 'sbtest" .. i .. "'...")
|
||||
db_query("DROP TABLE IF EXISTS sbtest".. i )
|
||||
print(string.format("Dropping table 'sbtest%d'...", i))
|
||||
con:query("DROP TABLE IF EXISTS sbtest" .. i )
|
||||
end
|
||||
end
|
||||
|
||||
local function get_range_str()
|
||||
local start = sb_rand(1, oltp_table_size)
|
||||
return string.format("WHERE id BETWEEN %u AND %u",
|
||||
start, start + oltp_range_size - 1)
|
||||
end
|
||||
|
||||
function execute_point_selects(con, table_name)
|
||||
for i=1, oltp_point_selects do
|
||||
con:query(string.format("SELECT c FROM %s WHERE id=%u",
|
||||
table_name, sb_rand(1, oltp_table_size)))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_simple_ranges(con, table_name)
|
||||
for i=1, oltp_simple_ranges do
|
||||
con:query(string.format("SELECT c FROM %s %s",
|
||||
table_name, get_range_str()))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_sum_ranges(con, table_name)
|
||||
for i=1, oltp_sum_ranges do
|
||||
con:query(string.format("SELECT SUM(k) FROM %s %s",
|
||||
table_name, get_range_str()))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_order_ranges(con, table_name)
|
||||
for i=1, oltp_order_ranges do
|
||||
con:query(string.format("SELECT c FROM %s %s ORDER BY c",
|
||||
table_name, get_range_str()))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_distinct_ranges(con, table_name)
|
||||
for i=1, oltp_distinct_ranges do
|
||||
con:query(string.format("SELECT DISTINCT c FROM %s %s ORDER BY c",
|
||||
table_name, get_range_str()))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_index_updates(con, table_name)
|
||||
for i=1, oltp_index_updates do
|
||||
con:query(string.format("UPDATE %s SET k=k+1 WHERE id=%u",
|
||||
table_name, sb_rand(1, oltp_table_size)))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_non_index_updates(con, table_name)
|
||||
for i=1, oltp_non_index_updates do
|
||||
con:query(string.format("UPDATE %s SET c='%s' WHERE id=%u",
|
||||
table_name, get_c_value(),
|
||||
sb_rand(1, oltp_table_size)))
|
||||
end
|
||||
end
|
||||
|
||||
function execute_delete_inserts(con, table_name)
|
||||
for i=1, oltp_delete_inserts do
|
||||
local id = sb_rand(1, oltp_table_size)
|
||||
local k = sb_rand(1, oltp_table_size)
|
||||
|
||||
con:query(string.format("DELETE FROM %s WHERE id=%u", table_name, id))
|
||||
con:query(string.format("INSERT INTO %s (id, k, c, pad) VALUES " ..
|
||||
"(%d, %d, '%s', '%s')",
|
||||
table_name, id, k,
|
||||
get_c_value(), get_pad_value()))
|
||||
end
|
||||
end
|
||||
|
||||
@ -168,22 +249,6 @@ function set_vars()
|
||||
oltp_auto_inc = true
|
||||
end
|
||||
|
||||
if (oltp_read_only == 'on') then
|
||||
oltp_read_only = true
|
||||
else
|
||||
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
|
||||
|
||||
33
sysbench/lua/oltp_delete.lua
Normal file
33
sysbench/lua/oltp_delete.lua
Normal file
@ -0,0 +1,33 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Delete-Only OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
execute_delete_inserts(con, table_name)
|
||||
end
|
||||
50
sysbench/lua/oltp_insert.lua
Normal file
50
sysbench/lua/oltp_insert.lua
Normal file
@ -0,0 +1,50 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Insert-Only OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)\
|
||||
local k_val = sysbench.rand.default(1, oltp_table_size)
|
||||
local c_val = get_c_value()
|
||||
local pad_val = get_pad_value()
|
||||
|
||||
if (drv:name() == "pgsql" and oltp_auto_inc) then
|
||||
con:query(string.format("INSERT INTO %s (k, c, pad) VALUES " ..
|
||||
"(%d, '%s', '%s')",
|
||||
table_name, k_val, c_val, pad_val))
|
||||
else
|
||||
if (oltp_auto_inc) then
|
||||
i = 0
|
||||
else
|
||||
i = sysbench.rand.unique()
|
||||
end
|
||||
|
||||
con:query(string.format("INSERT INTO %s (id, k, c, pad) VALUES " ..
|
||||
"(%d, %d, '%s', '%s')",
|
||||
table_name, i, k_val, c_val, pad_val))
|
||||
end
|
||||
end
|
||||
@ -26,12 +26,6 @@ else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function thread_init()
|
||||
set_vars()
|
||||
drv = sysbench.sql.driver()
|
||||
con = drv:connect()
|
||||
end
|
||||
|
||||
function event()
|
||||
con:query(string.format("SELECT c FROM sbtest%d WHERE id=%d",
|
||||
sysbench.rand.uniform(1, oltp_tables_count),
|
||||
|
||||
47
sysbench/lua/oltp_read_only.lua
Normal file
47
sysbench/lua/oltp_read_only.lua
Normal file
@ -0,0 +1,47 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Read-Only OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("BEGIN")
|
||||
end
|
||||
|
||||
execute_point_selects(con, table_name)
|
||||
|
||||
if oltp_range_selects then
|
||||
execute_simple_ranges(con, table_name)
|
||||
execute_sum_ranges(con, table_name)
|
||||
execute_order_ranges(con, table_name)
|
||||
execute_distinct_ranges(con, table_name)
|
||||
end
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("COMMIT")
|
||||
end
|
||||
end
|
||||
52
sysbench/lua/oltp_read_write.lua
Normal file
52
sysbench/lua/oltp_read_write.lua
Normal file
@ -0,0 +1,52 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Read/Write OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("BEGIN")
|
||||
end
|
||||
|
||||
execute_point_selects(con, table_name)
|
||||
|
||||
if oltp_range_selects then
|
||||
execute_simple_ranges(con, table_name)
|
||||
execute_sum_ranges(con, table_name)
|
||||
execute_order_ranges(con, table_name)
|
||||
execute_distinct_ranges(con, table_name)
|
||||
end
|
||||
|
||||
execute_index_updates(con, table_name)
|
||||
execute_non_index_updates(con, table_name)
|
||||
execute_delete_inserts(con, table_name)
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("COMMIT")
|
||||
end
|
||||
end
|
||||
33
sysbench/lua/oltp_update_index.lua
Normal file
33
sysbench/lua/oltp_update_index.lua
Normal file
@ -0,0 +1,33 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Update-Index OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
execute_index_updates(con, table_name)
|
||||
end
|
||||
33
sysbench/lua/oltp_update_non_index.lua
Normal file
33
sysbench/lua/oltp_update_non_index.lua
Normal file
@ -0,0 +1,33 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Update-Non-Index OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
execute_non_index_updates(con, table_name)
|
||||
end
|
||||
43
sysbench/lua/oltp_write_only.lua
Normal file
43
sysbench/lua/oltp_write_only.lua
Normal file
@ -0,0 +1,43 @@
|
||||
-- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
|
||||
|
||||
-- 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
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Write-Only OLTP benchmark
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
pathtest = string.match(test, "(.*/)")
|
||||
|
||||
if pathtest then
|
||||
dofile(pathtest .. "oltp_common.lua")
|
||||
else
|
||||
require("oltp_common")
|
||||
end
|
||||
|
||||
function event()
|
||||
local table_name = "sbtest" .. sb_rand_uniform(1, oltp_tables_count)
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("BEGIN")
|
||||
end
|
||||
|
||||
execute_index_updates(con, table_name)
|
||||
execute_non_index_updates(con, table_name)
|
||||
execute_delete_inserts(con, table_name)
|
||||
|
||||
if not oltp_skip_trx then
|
||||
con:query("COMMIT")
|
||||
end
|
||||
end
|
||||
@ -15,8 +15,6 @@
|
||||
|
||||
set -eu
|
||||
|
||||
OLTP_SCRIPT_PATH=${OLTP_SCRIPT_PATH:-${SBTEST_INCDIR}/oltp_legacy/oltp.lua}
|
||||
|
||||
ARGS="--test=${OLTP_SCRIPT_PATH} $DB_DRIVER_ARGS --oltp-tables-count=8"
|
||||
|
||||
sysbench $ARGS prepare
|
||||
@ -45,7 +43,7 @@ db_show_table sbtest7 || true # Error on non-existing table
|
||||
db_show_table sbtest8 || true # Error on non-existing table
|
||||
|
||||
# Test --oltp-create-secondary=off
|
||||
ARGS="--test=${SBTEST_INCDIR}/oltp_legacy/oltp.lua $DB_DRIVER_ARGS --oltp-tables-count=1"
|
||||
ARGS="--test=${OLTP_SCRIPT_PATH} $DB_DRIVER_ARGS --oltp-tables-count=1"
|
||||
|
||||
sysbench $ARGS --oltp-create-secondary=off prepare
|
||||
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
|
||||
OLTP_SCRIPT_PATH=${SBTEST_SCRIPTDIR}/oltp_point_select.lua
|
||||
|
||||
. ${SBTEST_INCDIR}/script_oltp_common.sh
|
||||
@ -15,6 +15,7 @@ SQL Lua API tests
|
||||
> end
|
||||
>
|
||||
> function event()
|
||||
> print("drv:name() = " .. drv:name())
|
||||
> for k,v in pairs(sysbench.sql.type) do print(k .. " = " .. v) end
|
||||
> print()
|
||||
>
|
||||
@ -56,6 +57,7 @@ SQL Lua API tests
|
||||
$ mysql -uroot sbtest -Nse "DROP TABLE IF EXISTS t"
|
||||
|
||||
$ sysbench $SB_ARGS run
|
||||
drv:name() = mysql
|
||||
NONE = 0
|
||||
INT = 3
|
||||
CHAR = 11
|
||||
|
||||
@ -13,10 +13,9 @@ Make sure all available DB drivers are covered
|
||||
> done
|
||||
|
||||
# Try using a non-existing driver
|
||||
$ sysbench --db-driver=nonexisting --test=${SBTEST_SCRIPTDIR}/oltp.lua cleanup
|
||||
$ sysbench --db-driver=nonexisting --test=${SBTEST_SCRIPTDIR}/oltp_read_write.lua cleanup
|
||||
sysbench * (glob)
|
||||
|
||||
Dropping table 'sbtest1'...
|
||||
(FATAL: invalid database driver name: 'nonexisting'|FATAL: No DB drivers available) (re)
|
||||
FATAL: failed to execute function `cleanup': *common.lua:*: DB initialization failed (glob)
|
||||
FATAL: failed to execute function `cleanup': * failed to initialize the DB driver (glob)
|
||||
[1]
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
> exit 80
|
||||
> fi
|
||||
|
||||
$ sysbench --test=${SBTEST_SCRIPTDIR}/oltp.lua --db-driver=mysql --mysql-dry-run --max-time=3 --max-requests=0 --report-checkpoints=1,2 run | egrep '(Checkpoint report|OLTP test statistics)'
|
||||
$ sysbench --test=${SBTEST_SCRIPTDIR}/oltp_read_write.lua --db-driver=mysql --mysql-dry-run --max-time=3 --max-requests=0 --report-checkpoints=1,2 run | egrep '(Checkpoint report|OLTP test statistics)'
|
||||
[ 1s] Checkpoint report:
|
||||
OLTP test statistics:
|
||||
[ 2s] Checkpoint report:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
> exit 80
|
||||
> fi
|
||||
|
||||
$ sysbench --test=${SBTEST_SCRIPTDIR}/oltp.lua --db-driver=mysql --mysql-dry-run --max-time=3 --max-requests=0 --report-interval=1 run | grep '\[ 2s\]'
|
||||
$ sysbench --test=${SBTEST_SCRIPTDIR}/oltp_read_write.lua --db-driver=mysql --mysql-dry-run --max-time=3 --max-requests=0 --report-interval=1 run | grep '\[ 2s\]'
|
||||
[ 2s] threads: 1 tps: * qps: * (r/w/o: */*/*) latency: *ms (95%) errors/s: 0.00 reconnects/s: 0.00 (glob)
|
||||
|
||||
# Run a test that does not support intermediate reports
|
||||
|
||||
@ -12,7 +12,8 @@ oltp_point_select.lua + MySQL tests
|
||||
> }
|
||||
|
||||
$ DB_DRIVER_ARGS="--db-driver=mysql --mysql-table-engine=innodb $SBTEST_MYSQL_ARGS"
|
||||
$ . $SBTEST_INCDIR/script_oltp_point_select_common.sh
|
||||
$ OLTP_SCRIPT_PATH=${SBTEST_SCRIPTDIR}/oltp_point_select.lua
|
||||
$ . $SBTEST_INCDIR/script_oltp_common.sh
|
||||
sysbench *.* * (glob)
|
||||
|
||||
Creating table 'sbtest1'...
|
||||
@ -42,83 +43,83 @@ oltp_point_select.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest2
|
||||
CREATE TABLE `sbtest2` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest3
|
||||
CREATE TABLE `sbtest3` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest4
|
||||
CREATE TABLE `sbtest4` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest5
|
||||
CREATE TABLE `sbtest5` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest6
|
||||
CREATE TABLE `sbtest6` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest7
|
||||
CREATE TABLE `sbtest7` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest8
|
||||
CREATE TABLE `sbtest8` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest9' doesn't exist
|
||||
sysbench *.* * (glob)
|
||||
|
||||
@ -182,12 +183,12 @@ oltp_point_select.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
sysbench * (glob)
|
||||
|
||||
Dropping table 'sbtest1'...
|
||||
|
||||
@ -7,13 +7,13 @@ oltp_point_select.lua + PostgreSQL tests
|
||||
> exit 80
|
||||
> fi
|
||||
|
||||
$ DB_DRIVER_ARGS="--db-driver=pgsql $SBTEST_PGSQL_ARGS"
|
||||
|
||||
$ function db_show_table() {
|
||||
> psql -c "\d+ $1" sbtest
|
||||
> }
|
||||
|
||||
$ . $SBTEST_INCDIR/script_oltp_point_select_common.sh
|
||||
$ DB_DRIVER_ARGS="--db-driver=pgsql $SBTEST_PGSQL_ARGS"
|
||||
$ OLTP_SCRIPT_PATH=${SBTEST_SCRIPTDIR}/oltp_point_select.lua
|
||||
$ . $SBTEST_INCDIR/script_oltp_common.sh
|
||||
sysbench *.* * (glob)
|
||||
|
||||
Creating table 'sbtest1'...
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
########################################################################
|
||||
oltp.lua + MySQL tests
|
||||
oltp_read_write.lua + MySQL tests
|
||||
########################################################################
|
||||
|
||||
$ if [ -z "${SBTEST_MYSQL_ARGS:-}" ]
|
||||
@ -12,6 +12,7 @@ oltp.lua + MySQL tests
|
||||
> }
|
||||
|
||||
$ DB_DRIVER_ARGS="--db-driver=mysql --mysql-table-engine=myisam $SBTEST_MYSQL_ARGS"
|
||||
$ OLTP_SCRIPT_PATH=${SBTEST_SCRIPTDIR}/oltp_read_write.lua
|
||||
$ . $SBTEST_INCDIR/script_oltp_common.sh
|
||||
sysbench *.* * (glob)
|
||||
|
||||
@ -42,83 +43,83 @@ oltp.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest2
|
||||
CREATE TABLE `sbtest2` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest3
|
||||
CREATE TABLE `sbtest3` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest4
|
||||
CREATE TABLE `sbtest4` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest5
|
||||
CREATE TABLE `sbtest5` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest6
|
||||
CREATE TABLE `sbtest6` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest7
|
||||
CREATE TABLE `sbtest7` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest8
|
||||
CREATE TABLE `sbtest8` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest9' doesn't exist
|
||||
sysbench *.* * (glob)
|
||||
|
||||
@ -182,12 +183,12 @@ oltp.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
sysbench * (glob)
|
||||
|
||||
Dropping table 'sbtest1'...
|
||||
@ -223,83 +224,83 @@ oltp.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest2
|
||||
CREATE TABLE `sbtest2` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest3
|
||||
CREATE TABLE `sbtest3` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest4
|
||||
CREATE TABLE `sbtest4` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest5
|
||||
CREATE TABLE `sbtest5` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest6
|
||||
CREATE TABLE `sbtest6` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest7
|
||||
CREATE TABLE `sbtest7` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
*************************** 1. row ***************************
|
||||
sbtest8
|
||||
CREATE TABLE `sbtest8` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
ERROR 1146 (42S02) at line 1: Table 'sbtest.sbtest9' doesn't exist
|
||||
sysbench *.* * (glob)
|
||||
|
||||
@ -363,12 +364,12 @@ oltp.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
sysbench * (glob)
|
||||
|
||||
Dropping table 'sbtest1'...
|
||||
@ -1,5 +1,5 @@
|
||||
########################################################################
|
||||
oltp.lua + PostgreSQL tests
|
||||
oltp_read_write.lua + PostgreSQL tests
|
||||
########################################################################
|
||||
|
||||
$ if [ -z "${SBTEST_PGSQL_ARGS:-}" ]
|
||||
@ -7,12 +7,12 @@ oltp.lua + PostgreSQL tests
|
||||
> exit 80
|
||||
> fi
|
||||
|
||||
$ DB_DRIVER_ARGS="--db-driver=pgsql $SBTEST_PGSQL_ARGS"
|
||||
|
||||
$ function db_show_table() {
|
||||
> psql -c "\d+ $1" sbtest
|
||||
> }
|
||||
|
||||
$ DB_DRIVER_ARGS="--db-driver=pgsql $SBTEST_PGSQL_ARGS"
|
||||
$ OLTP_SCRIPT_PATH=${SBTEST_SCRIPTDIR}/oltp_read_write.lua
|
||||
$ . $SBTEST_INCDIR/script_oltp_common.sh
|
||||
sysbench *.* * (glob)
|
||||
|
||||
@ -21,13 +21,13 @@ select_random_*.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
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
|
||||
@ -91,13 +91,13 @@ select_random_*.lua + MySQL tests
|
||||
*************************** 1. row ***************************
|
||||
sbtest1
|
||||
CREATE TABLE `sbtest1` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`k` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`k` int(11) 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)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=* (glob)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user