File: script_oltp_common.sh

package info (click to toggle)
sysbench 1.0.20%2Bds-8
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,840 kB
  • sloc: ansic: 11,830; sh: 1,752; xml: 736; makefile: 195
file content (86 lines) | stat: -rw-r--r-- 2,570 bytes parent folder | download | duplicates (4)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
#
################################################################################
# Common code for OLTP tests
#
# Expects the following variables and callback functions to be defined by the
# caller:
#
#   DB_DRIVER_ARGS -- extra driver-specific arguments to pass to sysbench
#   OLTP_SCRIPT_PATH -- path to the script file to execute
#   SB_EXTRA_ARGS -- optional variable to specify extra sysbench arguments
#
#   db_show_table() -- called with a single argument to dump a specified table
#                      schema
################################################################################

set -eu

SB_EXTRA_ARGS=${SB_EXTRA_ARGS:-}

# Test single-threaded prepare/prewarm/cleanup output

ARGS="${OLTP_SCRIPT_PATH} ${DB_DRIVER_ARGS} --tables=8 --threads=1 ${SB_EXTRA_ARGS}"
sysbench $ARGS prepare

db_show_table sbtest1
db_show_table sbtest2
db_show_table sbtest3
db_show_table sbtest4
db_show_table sbtest5
db_show_table sbtest6
db_show_table sbtest7
db_show_table sbtest8
db_show_table sbtest9 || true # Error on non-existing table

sysbench $ARGS prewarm || true # MySQL-only
sysbench $ARGS cleanup

# Test parallel prepare/prewarm/cleanup. Parallelism may result in
# non-deterministic output, so we redirect it to /dev/null

ARGS="${OLTP_SCRIPT_PATH} ${DB_DRIVER_ARGS} --tables=8 --threads=2 ${SB_EXTRA_ARGS}"

sysbench $ARGS prepare >/dev/null

db_show_table sbtest1
db_show_table sbtest2
db_show_table sbtest3
db_show_table sbtest4
db_show_table sbtest5
db_show_table sbtest6
db_show_table sbtest7
db_show_table sbtest8
db_show_table sbtest9 || true # Error on non-existing table

sysbench $ARGS prewarm >/dev/null || true # MySQL only

sysbench --events=100 $ARGS run

sysbench $ARGS cleanup >/dev/null

db_show_table sbtest1 || true # Error on non-existing table
db_show_table sbtest2 || true # Error on non-existing table
db_show_table sbtest3 || true # Error on non-existing table
db_show_table sbtest4 || true # Error on non-existing table
db_show_table sbtest5 || true # Error on non-existing table
db_show_table sbtest6 || true # Error on non-existing table
db_show_table sbtest7 || true # Error on non-existing table
db_show_table sbtest8 || true # Error on non-existing table

echo "# Test --create-secondary=off"
ARGS="${OLTP_SCRIPT_PATH} ${DB_DRIVER_ARGS} ${SB_EXTRA_ARGS} --tables=1"

sysbench --create-secondary=off $ARGS prepare

db_show_table sbtest1

sysbench $ARGS cleanup

echo "# Test --auto-inc=off"

ARGS="$ARGS --auto-inc=off --verbosity=1"

sysbench $ARGS prepare
sysbench $ARGS run
sysbench $ARGS cleanup