forked from rijalati/alpine-ycsb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
44 lines (35 loc) · 1.03 KB
/
start.sh
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
#!/bin/mksh
set -vex
# maor load
function config_workloads
{
sed -i "s/recordcount=[0-9]*/recordcount=${RECNUM:=1000000}/g" \
/opt/ycsb-*/workloads/workload*
sed -i "s/operationcount=[0-9]*/operationcount=${OPNUM:=5000000}/g" \
/opt/ycsb-*/workloads/workload*
return
}
function load_data
{
if [[ ! -e /.loaded_data ]]; then
/opt/ycsb-*/bin/ycsb.sh load "${DBTYPE}" -s -P "workloads/workload${WORKLETTER}" "${DBARGS}" && touch /.loaded_data
fi
return
}
# exit message
trap 'echo "\n${progname} has finished\n"' EXIT
# make it easier to see logs in the rancher ui
sleep 5
# make sure all the params are set and go.
if [[ -z ${DBTYPE} || -z ${WORKLETTER} || -z ${DBARGS} ]]; then
echo "Missing params! Exiting"
exit 1
else
config_workloads
if [[ ! -z "${ACTION}" ]]; then
eval ./bin/ycsb "${ACTION}" "${DBTYPE}" -s -P "workloads/workload${WORKLETTER}" "${DBARGS}"
else
load_data
eval ./bin/ycsb run "${DBTYPE}" -s -P "workloads/workload${WORKLETTER}" "${DBARGS}"
fi
fi