Debug when start-sandbox fails.

This commit is contained in:
Daniel Nichter
2012-07-31 17:15:55 -06:00
parent c769f4df11
commit d19844b94c
2 changed files with 21 additions and 4 deletions

View File

@@ -42,10 +42,10 @@ cd $PWD
echo -n "Starting MySQL test server on port PORT... "
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
sleep 1
if [ -f $PIDFILE -a -S $SOCKETFILE -a -s "/tmp/PORT/data/ibdata1" ]; then
break
fi
sleep 1
done
for i in 1 2 3 4 5; do

View File

@@ -9,6 +9,23 @@ die() {
exit 1
}
debug_sandbox() {
local port="$1"
echo
echo "MySQL processes:" >&2
ps x | grep mysql >&2
echo
if [ -d "/tmp/$port" ]; then
ls -lh /tmp/$port/* >&2
echo
cat /tmp/$port/data/mysqld.log >&2
echo
tail -n 100 /tmp/$port/data/genlog >&2
else
echo "/tmp/$port does not exist" >&2
fi
}
make_sandbox() {
# Make the sandbox dir and extract the base files.
rm -rf /tmp/$port || die "can't rm /tmp/$port"
@@ -67,14 +84,14 @@ make_sandbox() {
/tmp/$port/use -e 'SHOW /*!40100 ENGINE*/ INNODB STATUS' | grep 'INNODB MONITOR OUTPUT' >/dev/null 2>&1
# grep exits 0 if lines are found
if [ $? -ne 0 ]; then
echo "****** WARNING sandbox doesn't have a working InnoDB! ******" >&2
cat /tmp/$port/data/mysqld.log >&2
echo "Sandbox $type $port doesn't have InnoDB" >&2
debug_sandbox $port
exit 1
fi
fi
else
echo "Sandbox $type $port failed to start." >&2
cat /tmp/$port/data/mysqld.log >&2
debug_sandbox $port
exit 1
fi