Wait longer for sandboxes to start. Dump their info better if they don't.

This commit is contained in:
Daniel Nichter
2012-07-31 16:30:52 -06:00
parent 5754649a39
commit 8b15e2936b
2 changed files with 35 additions and 18 deletions

View File

@@ -41,18 +41,21 @@ $BASEDIR/bin/mysqld_safe --defaults-file=/tmp/PORT/my.sandbox.cnf > /dev/null 2>
cd $PWD cd $PWD
echo -n "Starting MySQL test server on port PORT... " echo -n "Starting MySQL test server on port PORT... "
for i in 1 2 3 4 5 6 7 8 9 10; do for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
sleep 1 sleep 1
if [ -f $PIDFILE ] && [ -S $SOCKETFILE ]; then if [ -f $PIDFILE -a -S $SOCKETFILE -a -s "/tmp/PORT/data/ibdata1" ]; then
break break
fi fi
done done
sandbox_is_alive for i in 1 2 3 4 5; do
if [ $? -eq 1 ]; then sandbox_is_alive
echo "OK" if [ $? -eq 1 ]; then
exit 0 echo "OK"
else exit 0
echo "FAILED" fi
exit 1 sleep 1
fi done
echo "FAILED"
exit 1

View File

@@ -7,17 +7,29 @@
# Exist 0 on success/no errors, or 1 on any warnings or errors. # Exist 0 on success/no errors, or 1 on any warnings or errors.
err() { err() {
echo "MySQL processes:" >&2
ps x | grep mysql >&2
echo "Sandbox servers:" >&2
ls /tmp/1234? >&2
ls /tmp/290? >&2
echo
for msg; do for msg; do
echo "$msg" >&2 echo "$msg" >&2
done done
if [ "$DEBUG_SANDBOXES" ]; then
echo
echo "MySQL processes:" >&2
ps x | grep mysql >&2
echo
for p in 12345 12346 12347; do
echo "Sandbox $p:" >&2
if [ -d "/tmp/$p" ]; then
ls -lh /tmp/$p/* >&2
echo
cat /tmp/$p/data/mysqld.log >&2
echo
tail -n 100 /tmp/$p/data/genlog >&2
else
echo "/tmp/$p does not exist" >&2
fi
done
fi
} }
usage() { usage() {
@@ -315,6 +327,7 @@ case $opt in
if [ $exit_status -eq 0 ]; then if [ $exit_status -eq 0 ]; then
echo "Percona Toolkit test environment started with MySQL v$MYSQL_VERSION." echo "Percona Toolkit test environment started with MySQL v$MYSQL_VERSION."
else else
DEBUG_SANDBOXES=1
err "There was an error starting the Percona Toolkit test environment." err "There was an error starting the Percona Toolkit test environment."
fi fi
;; ;;
@@ -327,6 +340,7 @@ case $opt in
if [ $exit_status -eq 0 ]; then if [ $exit_status -eq 0 ]; then
echo "Percona Toolkit test environment stopped." echo "Percona Toolkit test environment stopped."
else else
DEBUG_SANDBOXES=1
err "Error stopping the Percona Toolkit test environment." err "Error stopping the Percona Toolkit test environment."
fi fi
;; ;;