Files
2026-07-13 12:32:25 +08:00

111 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
#set -e
#set -o pipefail
PORT=54171
# Set the working directory to the directory of the script's location
cd "$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
mkdir -p mini_sysbench
cd mini_sysbench
if [ ! -d "./sysbench-lua-scripts" ]; then
git clone https://github.com/dolthub/sysbench-lua-scripts.git
fi
cp ./sysbench-lua-scripts/*.lua ./
go build -o doltgres.exe ../../cmd/doltgres/
values=(
"covering_index_scan_postgres"
"groupby_scan_postgres"
"index_join_postgres"
"index_join_scan_postgres"
"index_scan_postgres"
"oltp_point_select"
"oltp_read_only"
"select_random_points"
"select_random_ranges"
"table_scan_postgres"
"types_table_scan_postgres"
"oltp_delete_insert_postgres"
"oltp_insert"
"oltp_read_write"
"oltp_update_index"
"oltp_update_non_index"
"oltp_update_non_index"
"oltp_write_only"
"types_delete_insert_postgres"
)
for value in "${values[@]}"; do
SYSBENCH_TEST="$value"
cat <<YAML > dolt-config.yaml
log_level: info
behavior:
read_only: false
disable_client_multi_statements: false
dolt_transaction_commit: false
user:
name: "postgres"
password: "password"
listener:
host: localhost
port: $PORT
read_timeout_millis: 28800000
write_timeout_millis: 28800000
data_dir: .
YAML
rm -rf ./.dolt
rm -rf ./postgres
./doltgres.exe -config="dolt-config.yaml" 2> prepare.log &
SERVER_PID="$!"
sleep 1
echo "----$SYSBENCH_TEST----"
sysbench \
--db-driver="pgsql" \
--pgsql-host="0.0.0.0" \
--pgsql-port="$PORT" \
--pgsql-user="postgres" \
--pgsql-password="password" \
--pgsql-db="postgres" \
--db-ps-mode=disable \
--table-size=10000 \
--percentile=50 \
--rand-type=uniform \
--rand-seed=1 \
"$SYSBENCH_TEST" prepare
kill -15 "$SERVER_PID"
echo "----$SYSBENCH_TEST----" 1>> results.log
./doltgres.exe -config="dolt-config.yaml" 2> run.log &
SERVER_PID="$!"
sleep 1
sysbench \
--db-driver="pgsql" \
--pgsql-host="0.0.0.0" \
--pgsql-port="$PORT" \
--pgsql-user="postgres" \
--pgsql-password="password" \
--pgsql-db="postgres" \
--db-ps-mode=disable \
--table-size=10000 \
--percentile=50 \
--rand-type=uniform \
--rand-seed=1 \
--time=15 \
"$SYSBENCH_TEST" run 1>> results.log
sleep 1
kill -15 "$SERVER_PID"
echo "----$SYSBENCH_TEST----" 1>> results.log
done