From d19844b94cc5cb0042db946cae23e7e9f5b9b453 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Tue, 31 Jul 2012 17:15:55 -0600 Subject: [PATCH] Debug when start-sandbox fails. --- sandbox/servers/start | 2 +- sandbox/start-sandbox | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sandbox/servers/start b/sandbox/servers/start index 4dfc8f2d..7e849ea1 100755 --- a/sandbox/servers/start +++ b/sandbox/servers/start @@ -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 diff --git a/sandbox/start-sandbox b/sandbox/start-sandbox index 06a75248..d116c39c 100755 --- a/sandbox/start-sandbox +++ b/sandbox/start-sandbox @@ -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