Skip to content

Commit

Permalink
sysbench: create database if the database is not exist (pingcap#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwen0 authored Aug 14, 2017
1 parent fb38263 commit f5cb417
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sysbench/conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ port=4000
user=root
password=''
tcount=16
tsize=500000
tsize=1000000
threads=256
dbname=sbtest1

Expand Down
7 changes: 7 additions & 0 deletions sysbench/parallel-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ set -x

. ./conf.sh

if [[ ${password} = "" ]];
then
mysql -h ${host} -P ${port} -u${user} -e "CREATE DATABASE IF NOT EXISTS ${dbname}"
else
mysql -h ${host} -P ${port} -u${user} -p{$password} -e "CREATE DATABASE IF NOT EXISTS ${dbname}"
fi

sysbench --test=./lua-tests/db/oltp.lua --db-driver=${driver} --mysql-host=${host} --mysql-port=${port} \
--mysql-user=${user} --mysql-password=${password} --oltp-tables-count=${tcount} --mysql-db=${dbname} \
--oltp-table-size=0 --rand-init=on prepare
Expand Down
7 changes: 7 additions & 0 deletions sysbench/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ set -x

. ./conf.sh

if [[ ${password} = "" ]];
then
mysql -h ${host} -P ${port} -u${user} -e "CREATE DATABASE IF NOT EXISTS ${dbname}"
else
mysql -h ${host} -P ${port} -u${user} -p{$password} -e "CREATE DATABASE IF NOT EXISTS ${dbname}"
fi

sysbench --test=./lua-tests/db/oltp.lua --db-driver=${driver} --mysql-host=${host} --mysql-port=${port} \
--mysql-user=${user} --mysql-password=${password} --mysql-db=${dbname} \
--oltp-tables-count=${tcount} --oltp-table-size=${tsize} --rand-init=on prepare
Expand Down

0 comments on commit f5cb417

Please sign in to comment.