forked from akopytov/sysbench
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from risingwavelabs/lz/select_limit_10
add a simple limit 10 select
- Loading branch information
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env sysbench | ||
|
||
require("oltp_common") | ||
|
||
-- Override standard prepare/cleanup OLTP functions, as this benchmark does not | ||
-- support multiple tables | ||
oltp_prepare = prepare | ||
oltp_cleanup = cleanup | ||
|
||
function prepare() | ||
assert(sysbench.opt.tables == 1, "this benchmark does not support " .. | ||
"--tables > 1") | ||
oltp_prepare() | ||
end | ||
|
||
function cleanup() | ||
assert(sysbench.opt.tables == 1, "this benchmark does not support " .. | ||
"--tables > 1") | ||
oltp_cleanup() | ||
end | ||
|
||
function thread_init() | ||
drv = sysbench.sql.driver() | ||
con = drv:connect() | ||
|
||
local limit = "10" | ||
|
||
stmt = con:prepare(string.format([[ | ||
SELECT * | ||
FROM sbtest1 | ||
LIMIT %s]], limit)) | ||
|
||
rlen = sysbench.opt.table_size / sysbench.opt.threads | ||
|
||
thread_id = sysbench.tid % sysbench.opt.threads | ||
end | ||
|
||
function thread_done() | ||
stmt:close() | ||
con:disconnect() | ||
end | ||
|
||
function event() | ||
stmt:execute() | ||
|
||
check_reconnect() | ||
end |