mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-07 21:09:14 +00:00
simplify and clean up sandbox/test-env a little, also helps prevent error messages like this when running test-env: [Warning] option 'thread_stack': unsigned value 126976 adjusted to 131072
This commit is contained in:
@@ -73,7 +73,7 @@ our $trunk = $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
|
||||
our $sandbox_version = '';
|
||||
eval {
|
||||
chomp(my $v = `$trunk/sandbox/test-env version`);
|
||||
chomp(my $v = `$trunk/sandbox/test-env version 2>/dev/null`);
|
||||
$sandbox_version = $v if $v;
|
||||
};
|
||||
|
||||
|
@@ -46,29 +46,15 @@ mysql_basedir_ok() {
|
||||
}
|
||||
|
||||
set_mysql_basedir() {
|
||||
# Auto-detect basedir if its not explicitly set.
|
||||
if [ -z "$PERCONA_TOOLKIT_SANDBOX" ]; then
|
||||
BASEDIR_AUTO_DETECTED=1
|
||||
mysqld=`which mysqld 2>/dev/null`
|
||||
if [ -n "$mysqld" ]; then
|
||||
PERCONA_TOOLKIT_SANDBOX=`$mysqld --verbose --help 2>/dev/null | grep 'basedir ' | awk '{print $2}'`
|
||||
if [ -z "$PERCONA_TOOLKIT_SANDBOX" ]; then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
if [ -x "$PERCONA_TOOLKIT_SANDBOX/bin/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/bin/mysqld"
|
||||
elif [ -x "$PERCONA_TOOLKIT_SANDBOX/sbin/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/sbin/mysqld"
|
||||
elif [ -x "$PERCONA_TOOLKIT_SANDBOX/libexec/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/libexec/mysqld"
|
||||
else
|
||||
if [ -x "$PERCONA_TOOLKIT_SANDBOX/bin/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/bin/mysqld"
|
||||
elif [ -x "$PERCONA_TOOLKIT_SANDBOX/sbin/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/sbin/mysqld"
|
||||
elif [ -x "$PERCONA_TOOLKIT_SANDBOX/libexec/mysqld" ]; then
|
||||
mysqld="$PERCONA_TOOLKIT_SANDBOX/libexec/mysqld"
|
||||
else
|
||||
err "Cannot find executable mysqld in $PERCONA_TOOLKIT_SANDBOX/bin, $PERCONA_TOOLKIT_SANDBOX/sbin or $PERCONA_TOOLKIT_SANDBOX/libexec."
|
||||
return 0
|
||||
fi
|
||||
err "Cannot find executable mysqld in $PERCONA_TOOLKIT_SANDBOX/bin, $PERCONA_TOOLKIT_SANDBOX/sbin or $PERCONA_TOOLKIT_SANDBOX/libexec."
|
||||
return 0
|
||||
fi
|
||||
mysql_basedir_ok $PERCONA_TOOLKIT_SANDBOX
|
||||
local basedir_ok=$?
|
||||
@@ -149,7 +135,7 @@ sandbox_status() {
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "yes"
|
||||
|
||||
if [ "$version" != "4.0" ] && [ "$version" != "4.1" ]; then
|
||||
if [ "$MYSQL_VERSION" '>' "4.1" ]; then
|
||||
echo -n " sakila db is loaded - "
|
||||
/tmp/$port/use -e 'show databases like "sakila"' 2>/dev/null | grep sakila >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -244,7 +230,8 @@ kill_sandbox() {
|
||||
MYSQL_VERSION=""
|
||||
set_mysql_version() {
|
||||
if [ -d /tmp/12345 ] && [ -f /tmp/12345/use ]; then
|
||||
MYSQL_VERSION=$(/tmp/12345/use -N -e "select version()" | head -n 2 | tail -n 1 | cut -d'.' -f1,2)
|
||||
MYSQL_VERSION=$(/tmp/12345/use -ss -e "SELECT VERSION()" \
|
||||
| cut -d'.' -f1,2)
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -283,26 +270,18 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Determine the MySQL version.
|
||||
# bin/mysqld -V should print something like:
|
||||
# /usr/bin/mysqld Ver 5.1.34 for linux-gnu on x86_64 (MySQL Community Server)
|
||||
version=`$mysqld -V | awk '{print $3}' | cut -d. -f 1,2`;
|
||||
if [ ! -d "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version" ]; then
|
||||
err "Percona Toolkit sandbox server version $version does not exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $opt in
|
||||
start)
|
||||
cd $PERCONA_TOOLKIT_BRANCH/sandbox
|
||||
./start-sandbox master 12345
|
||||
exit_status=$((exit_status | $?))
|
||||
set_mysql_version
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
./start-sandbox slave 12346 12345
|
||||
exit_status=$((exit_status | $?))
|
||||
./start-sandbox slave 12347 12346
|
||||
exit_status=$((exit_status | $?))
|
||||
if [ $? -eq 0 -a "$version" != "4.0" -a "$version" != "4.1" ]; then
|
||||
if [ $? -eq 0 -a "$MYSQL_VERSION" '>' "4.1" ]; then
|
||||
echo -n "Loading sakila database... "
|
||||
./load-sakila-db 12345
|
||||
exit_status=$((exit_status | $?))
|
||||
@@ -314,7 +293,6 @@ case $opt in
|
||||
fi
|
||||
fi
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
set_mysql_version
|
||||
echo "Percona Toolkit test environment started with MySQL v$MYSQL_VERSION."
|
||||
else
|
||||
err "There was an error starting the Percona Toolkit test environment."
|
||||
|
Reference in New Issue
Block a user