1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Don't hardocde table name

This commit is contained in:
Andrey Piskunov
2022-07-20 20:51:33 +03:00
committed by Leonid Fedorov
parent 8290374f5b
commit a88e335cb7
2 changed files with 17 additions and 9 deletions

View File

@ -16,6 +16,7 @@ Available options:
-h, --help Print this help and exit -h, --help Print this help and exit
-d, --data Data for table that will be given to cpimport; if no name provided it will be generated. -d, --data Data for table that will be given to cpimport; if no name provided it will be generated.
-s, --size Size of the dataset to generate -s, --size Size of the dataset to generate
-t, --table Name of the table
EOF EOF
exit exit
} }
@ -30,6 +31,13 @@ cleanup() {
then then
sudo rm $DATA sudo rm $DATA
fi fi
sudo rm "${BRANCH}_bench.txt"
sudo rm "develop_bench.txt"
sysbench $SCRIPT --mysql-socket=/run/mysqld/mysqld.sock \
--db-driver=mysql \
--mysql-db=test \
cleanup
unset TABLE
} }
die() { die() {
@ -56,6 +64,7 @@ parse_params() {
SCRIPT="$2" SCRIPT="$2"
RANGE=1000000 RANGE=1000000
TABLE="t1"
while :; do while :; do
case "${1-}" in case "${1-}" in
@ -65,6 +74,9 @@ parse_params() {
-s | --size) RANGE="${2-}" -s | --size) RANGE="${2-}"
shift shift
;; ;;
-t | --table) TABLE="${2-}"
shift
;;
-?*) die "Unknown option: $1" ;; -?*) die "Unknown option: $1" ;;
*) break ;; *) break ;;
esac esac
@ -75,6 +87,7 @@ parse_params() {
} }
parse_params "$@" parse_params "$@"
export TABLE
cd $MDB_SOURCE_PATH/columnstore/columnstore/benchmarks cd $MDB_SOURCE_PATH/columnstore/columnstore/benchmarks
seq 1 $RANGE > "$DATA" seq 1 $RANGE > "$DATA"
@ -113,9 +126,4 @@ sysbench $SCRIPT \
--mysql-db=test \ --mysql-db=test \
--time=30 run | tail -n +12 > develop_bench.txt --time=30 run | tail -n +12 > develop_bench.txt
sysbench $SCRIPT --mysql-socket=/run/mysqld/mysqld.sock \
--db-driver=mysql \
--mysql-db=test \
cleanup
python3 parse_bench.py "$BRANCH" "${BRANCH}_bench.txt" "develop_bench.txt" python3 parse_bench.py "$BRANCH" "${BRANCH}_bench.txt" "develop_bench.txt"

View File

@ -2,12 +2,12 @@ require("bench_report")
function prepare () function prepare ()
local i local i
print("creating table test.t1 ...") print("creating table...")
db_query("create table t1 (c1 int)engine=columnstore") db_query("create table if not exists " .. os.getenv("TABLE") .. " (c1 int)engine=columnstore")
end end
function cleanup() function cleanup()
db_query("drop table t1") db_query("drop table if exists" .. os.getenv("TABLE") ..)
end end
function help() function help()
@ -22,7 +22,7 @@ function thread_done(thread_id)
end end
function event(thread_id) function event(thread_id)
db_query("select c1 from t1 where c1 = 5 or c1 = 10") db_query("select c1 from " .. os.getenv("TABLE") .. " where c1 = 5 or c1 = 10")
end end
sysbench.hooks.report_intermediate = sysbench.report_json sysbench.hooks.report_intermediate = sysbench.report_json