~hingo/percona-toolkit/pqd-mongodb-24

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
#!/bin/sh

die() {
   echo
   for msg; do
      echo $msg
   done
   exit 1
}

# ###########################################################################
# Sanity check the cmd line options.
# ###########################################################################
if [ $# -lt 1 ]; then
   die "Usage: load-sakila-db PORT"
fi

PORT=$1

if [ ! -d "/tmp/$PORT" ]; then
   die "MySQL test server does not exist: /tmp/$PORT"
fi

# ###########################################################################
# Sanity check the environment.
# ###########################################################################
if [ -z "$PERCONA_TOOLKIT_BRANCH" ]; then
   die "PERCONA_TOOLKIT_BRANCH environment variable is not set."
fi

if [ ! -d "$PERCONA_TOOLKIT_BRANCH" ]; then
   die "Invalid PERCONA_TOOLKIT_BRANCH directory: $PERCONA_TOOLKIT_BRANCH"
fi

/tmp/$PORT/use < $PERCONA_TOOLKIT_BRANCH/sandbox/sakila.sql
exit_status=$?

/tmp/$PORT/use sakila -e "ANALYZE TABLE actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store" >/dev/null

exit $exit_status