forked from swarm64/s64da-benchmark-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo-umbra-htap
executable file
·44 lines (33 loc) · 1.76 KB
/
demo-umbra-htap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -uo pipefail
# Make sure that we actually clean up after ourselves even if the user kills the shell while we are still waiting for the server to shutdown
trap "echo shell received SIGINT, sending SIGKILL to all child processes; kill -9 -- 0" SIGINT
trap "echo shell received SIGTERM, sending SIGKILL to all child processes; kill -9 -- 0" SIGTERM
# Also do this when the shell exits with an error in case one of the Python commands failed
trap "echo subcommand exited with error, sending SIGKILL to all child processes; kill -9 -- 0" ERR
UMBRA_PATH=${UMBRA_PATH:-.}
DB_PATH=${DB_PATH:-.}
UMBRA_PORT=${UMBRA_PORT:-54321}
SCALE_FACTOR=$1
OLTP_WORKERS=$2
OLAP_WORKERS=$3
if [ ! -f ${DB_PATH}/htap/umbra.db ]; then
echo "initializing clean benchmark database"
# Clear the database directory
rm -rf ${DB_PATH}/htap
mkdir -p ${DB_PATH}/htap
# Create the initial database state and start a server
VERBOSITY=warning ${UMBRA_PATH}/sql -createdb ${DB_PATH}/htap/umbra.db <<< "ALTER ROLE postgres WITH LOGIN PASSWORD 'postgres';"
VERBOSITY=panic ${UMBRA_PATH}/server -port ${UMBRA_PORT} -address localhost ${DB_PATH}/htap/umbra.db &
# Load the initial database population
./prepare_benchmark --umbra --dsn postgresql://postgres:postgres@localhost:${UMBRA_PORT}/htap --benchmark htap --scale-factor ${SCALE_FACTOR} --schema umbra
else
echo "using existing benchmark database"
# Start a server on the existing database
VERBOSITY=panic ${UMBRA_PATH}/server -port ${UMBRA_PORT} ${DB_PATH}/htap/umbra.db &
fi
# Run the HTAP benchmark
./run_benchmark --umbra --dsn postgresql://postgres:postgres@localhost:${UMBRA_PORT}/htap htap --dont-wait-until-enough-data --oltp-workers ${OLTP_WORKERS} --olap-workers ${OLAP_WORKERS}
# Shutdown the server
kill -INT %1
wait