Portability fixes.
Changed mysql-test-run.sh to test for files to get shorter, more reliable timeouts.
This commit is contained in:
parent
6b02f13cf3
commit
db2e22bf7e
@ -13636,7 +13636,6 @@ connection between a MySQL server and a MySQL client.
|
||||
If you are using MySQL 4.0, you can also use internal openssl support.
|
||||
@xref{Secure connections}.
|
||||
|
||||
|
||||
To make a MySQL system secure, you should strongly consider the
|
||||
following suggestions:
|
||||
|
||||
@ -13652,8 +13651,7 @@ this:
|
||||
|
||||
@example
|
||||
shell> mysql -u root mysql
|
||||
mysql> UPDATE user SET Password=PASSWORD('new_password')
|
||||
WHERE user='root';
|
||||
mysql> UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
@end example
|
||||
|
||||
@ -15395,17 +15393,17 @@ password using the @code{PASSWORD()} function):
|
||||
|
||||
@example
|
||||
shell> mysql -u root mysql
|
||||
mysql> UPDATE user SET Password=PASSWORD('new_password')
|
||||
WHERE user='root';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
mysql> SET PASSWORD FOR root@@localhost=PASSWORD('new_password');
|
||||
@end example
|
||||
|
||||
You can, in MySQL Version 3.22 and above, use the @code{SET PASSWORD}
|
||||
statement:
|
||||
If you know what you are doing, you can also directly manipulate the
|
||||
privilege tables:
|
||||
|
||||
@example
|
||||
shell> mysql -u root mysql
|
||||
mysql> SET PASSWORD FOR root=PASSWORD('new_password');
|
||||
mysql> UPDATE user SET Password=PASSWORD('new_password')
|
||||
WHERE user='root';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
@end example
|
||||
|
||||
Another way to set the password is by using the @code{mysqladmin} command:
|
||||
|
@ -75,15 +75,19 @@
|
||||
#define MAX_EXPECTED_ERRORS 10
|
||||
#define QUERY_SEND 1
|
||||
#define QUERY_REAP 2
|
||||
#define CON_RETRY_SLEEP 1 /* how long to sleep before trying to connect again*/
|
||||
#define MAX_CON_TRIES 2 /* sometimes in a test the client starts before
|
||||
* the server - to solve the problem, we try again
|
||||
* after some sleep if connection fails the first
|
||||
* time */
|
||||
#ifndef MYSQL_MANAGER_PORT
|
||||
#define MYSQL_MANAGER_PORT 23546
|
||||
#endif
|
||||
|
||||
/*
|
||||
Sometimes in a test the client starts before
|
||||
the server - to solve the problem, we try again
|
||||
after some sleep if connection fails the first
|
||||
time
|
||||
*/
|
||||
#define CON_RETRY_SLEEP 2
|
||||
#define MAX_CON_TRIES 5
|
||||
|
||||
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
|
||||
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
|
||||
|
||||
|
@ -43,6 +43,39 @@ which ()
|
||||
}
|
||||
|
||||
|
||||
sleep_until_file_deleted ()
|
||||
{
|
||||
file=$1
|
||||
loop=$SLEEP_TIME
|
||||
while (test $loop -gt 0)
|
||||
do
|
||||
sleep 1
|
||||
if [ ! -f $file ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
loop=`expr $loop - 1`
|
||||
done
|
||||
}
|
||||
|
||||
sleep_until_file_exists ()
|
||||
{
|
||||
file=$1
|
||||
loop=60 # Should be long enough enough for all cases
|
||||
while (test $loop -gt 0)
|
||||
do
|
||||
sleep 1
|
||||
if [ -f $file ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
loop=`expr $loop - 1`
|
||||
done
|
||||
echo "ERROR: $file was not created in 60 seconds; Aborting"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
|
||||
# No paths below as we can't be sure where the program is!
|
||||
|
||||
BASENAME=`which basename | head -1`
|
||||
@ -139,7 +172,7 @@ DO_GCOV=""
|
||||
DO_GDB=""
|
||||
DO_DDD=""
|
||||
DO_CLIENT_GDB=""
|
||||
SLEEP_TIME=2
|
||||
SLEEP_TIME=10
|
||||
CHARACTER_SET=latin1
|
||||
DBUSER=""
|
||||
START_WAIT_TIMEOUT=3
|
||||
@ -503,19 +536,17 @@ mysql_install_db () {
|
||||
|
||||
for slave_num in 1 2 ;
|
||||
do
|
||||
rm -rf var/slave$slave_num-data/
|
||||
$RM -rf var/slave$slave_num-data/
|
||||
mkdir -p var/slave$slave_num-data/mysql
|
||||
mkdir -p var/slave$slave_num-data/test
|
||||
cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
|
||||
done
|
||||
# Give mysqld some time to die.
|
||||
sleep $SLEEP_TIME
|
||||
return 0
|
||||
}
|
||||
|
||||
gprof_prepare ()
|
||||
{
|
||||
rm -rf $GPROF_DIR
|
||||
$RM -rf $GPROF_DIR
|
||||
mkdir -p $GPROF_DIR
|
||||
}
|
||||
|
||||
@ -575,7 +606,7 @@ start_manager()
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f $MANAGER_PID_FILE
|
||||
$RM -f $MANAGER_PID_FILE
|
||||
MYSQL_MANAGER_PW=`$MYSQL_MANAGER_PWGEN -u $MYSQL_MANAGER_USER \
|
||||
-o $MYSQL_MANAGER_PW_FILE`
|
||||
$MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \
|
||||
@ -653,7 +684,9 @@ start_master()
|
||||
$RM -f $MASTER_MYDDIR/log.*
|
||||
# Remove stale binary logs
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
|
||||
|
||||
#run master initialization shell script if one exists
|
||||
|
||||
if [ -f "$master_init_script" ] ;
|
||||
then
|
||||
/bin/sh $master_init_script
|
||||
@ -722,6 +755,7 @@ EOF
|
||||
else
|
||||
manager_launch master $MYSQLD $master_args
|
||||
fi
|
||||
sleep_until_file_exists $MASTER_MYPID
|
||||
MASTER_RUNNING=1
|
||||
}
|
||||
|
||||
@ -813,9 +847,11 @@ start_slave()
|
||||
manager_launch $slave_ident $SLAVE_MYSQLD $slave_args
|
||||
fi
|
||||
eval "SLAVE$1_RUNNING=1"
|
||||
sleep_until_file_exists $slave_pid
|
||||
}
|
||||
|
||||
mysql_start () {
|
||||
mysql_start ()
|
||||
{
|
||||
$ECHO "Starting MySQL daemon"
|
||||
start_master
|
||||
start_slave
|
||||
@ -840,8 +876,8 @@ stop_slave ()
|
||||
then # try harder!
|
||||
$ECHO "slave not cooperating with mysqladmin, will try manual kill"
|
||||
kill `$CAT $slave_pid`
|
||||
sleep $SLEEP_TIME
|
||||
if [ -f $SLAVE_MYPID ] ; then
|
||||
sleep_until_file_deleted $slave_pid
|
||||
if [ -f $slave_pid ] ; then
|
||||
$ECHO "slave refused to die. Sending SIGKILL"
|
||||
kill -9 `$CAT $slave_pid`
|
||||
$RM -f $slave_pid
|
||||
@ -862,7 +898,7 @@ stop_master ()
|
||||
then # try harder!
|
||||
$ECHO "master not cooperating with mysqladmin, will try manual kill"
|
||||
kill `$CAT $MASTER_MYPID`
|
||||
sleep $SLEEP_TIME
|
||||
sleep_until_file_deleted $MASTER_MYPID
|
||||
if [ -f $MASTER_MYPID ] ; then
|
||||
$ECHO "master refused to die. Sending SIGKILL"
|
||||
kill -9 `$CAT $MASTER_MYPID`
|
||||
@ -890,11 +926,10 @@ mysql_stop ()
|
||||
return 1
|
||||
}
|
||||
|
||||
mysql_restart () {
|
||||
|
||||
mysql_restart ()
|
||||
{
|
||||
mysql_stop
|
||||
mysql_start
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -1073,7 +1108,6 @@ run_testcase ()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# Main script starts here
|
||||
######################################################################
|
||||
@ -1083,16 +1117,38 @@ run_testcase ()
|
||||
[ "$DO_GCOV" ] && gcov_prepare
|
||||
[ "$DO_GPROF" ] && gprof_prepare
|
||||
|
||||
# Ensure that no old mysqld test servers are running
|
||||
if [ -z "$USE_RUNNING_SERVER" ]
|
||||
then
|
||||
# Ensure that no old mysqld test servers are running
|
||||
$MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
|
||||
$MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
|
||||
$MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
|
||||
$MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
|
||||
$MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
|
||||
sleep_until_file_deleted $MASTER_MYPID
|
||||
sleep_until_file_deleted $SLAVE_MYPID
|
||||
|
||||
# Kill any running managers
|
||||
if [ -f "$MANAGER_PID_FILE" ]
|
||||
then
|
||||
kill `cat $MANAGER_PID_FILE`
|
||||
sleep 1
|
||||
if [ -f "$MANAGER_PID_FILE" ]
|
||||
then
|
||||
kill -9 `cat $MANAGER_PID_FILE`
|
||||
sleep 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove files that can cause problems
|
||||
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
|
||||
|
||||
$ECHO "Installing Test Databases"
|
||||
mysql_install_db
|
||||
start_manager
|
||||
#do not automagically start deamons if we are in gdb or running only one test
|
||||
#case
|
||||
|
||||
# Do not automagically start deamons if we are in gdb or running only one test
|
||||
# case
|
||||
if [ -z "$DO_GDB" ] && [ -z "$DO_DDD" ]
|
||||
then
|
||||
mysql_start
|
||||
|
@ -291,10 +291,4 @@ show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
reset query cache;
|
||||
show variables like "query_cache_size";
|
||||
Variable_name Value
|
||||
query_cache_size 1039700
|
||||
show status like "Qcache_free_memory";
|
||||
Variable_name Value
|
||||
Qcache_free_memory 1039700
|
||||
drop table t1;
|
||||
|
@ -178,6 +178,9 @@ enable_result_log;
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_queries_in_cache";
|
||||
reset query cache;
|
||||
show variables like "query_cache_size";
|
||||
show status like "Qcache_free_memory";
|
||||
drop table t1;
|
||||
|
||||
# The following tests can't be done as the values differen on 32 and 64 bit
|
||||
# machines :(
|
||||
#show variables like "query_cache_size";
|
||||
#show status like "Qcache_free_memory";
|
||||
|
@ -2672,6 +2672,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path)
|
||||
|
||||
void Query_cache::wreck(uint line, const char *message)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
DBUG_ENTER("Query_cache::wreck");
|
||||
query_cache_size = 0;
|
||||
if (*message)
|
||||
@ -2679,7 +2680,8 @@ void Query_cache::wreck(uint line, const char *message)
|
||||
DBUG_PRINT("warning", ("=================================="));
|
||||
DBUG_PRINT("warning", ("%5d QUERY CACHE WRECK => DISABLED",line));
|
||||
DBUG_PRINT("warning", ("=================================="));
|
||||
current_thd->killed = 1;
|
||||
if (thd)
|
||||
thd->killed = 1;
|
||||
bins_dump();
|
||||
cache_dump();
|
||||
DBUG_VOID_RETURN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user