You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
964 B

1 month ago
#!/usr/bin/sysbench
require("account_common")
function thread_init()
print("thread_init ID:" .. thread_id .. " max:" .. sysbench.opt.threads)
drv = sysbench.sql.driver()
con = drv:connect()
end
function thread_done()
print("thread_done ID:" .. thread_id)
con:disconnect()
end
function update_one_account()
local one_thread_count = account_table_max / sysbench.opt.threads;
local db_index = thread_id * one_thread_count + sysbench.rand.default(1, one_thread_count);
local account_id = sysbench.rand.default(1, 5000)
local update_type = sysbench.rand.default(1, 10)
if update_type == 1 then
con:query(update_account_grade_cmd(db_index, account_id));
elseif update_type <= 4 then
con:query(update_account_realm_cmd(db_index, account_id));
elseif update_type <= 10 then
con:query(update_account_exdata_cmd(db_index, account_id));
end
end
function event()
update_one_account();
end