Commit 3e54e539 authored by unknown's avatar unknown

Fixes for OSF1

Made test more reliable on slow machines


Docs/manual.texi:
  Changelog
client/mysqladmin.c:
  Made --silent more silent
include/my_pthread.h:
  Removed warning on OSF1
mysql-test/install_test_db.sh:
  Allow connections from 127.0.0.1
mysql-test/mysql-test-run.sh:
  Use mysqladmin ping to test if server is up
mysql-test/r/rpl000015.result:
  Added sleep to make results repeatable
mysql-test/t/rpl000015.test:
  Added sleep to make results repeatable
mysql-test/t/rpl000016.test:
  Added sleep to make results repeatable
sql/sql_repl.cc:
  added DBUG entry
sql/sql_table.cc:
  Removed comparison of virtual functions as this didn't work on
  Compaq C++ on OSF1
parent 66321029
...@@ -40713,6 +40713,9 @@ not yet 100 % confident in this code. ...@@ -40713,6 +40713,9 @@ not yet 100 % confident in this code.
@appendixsubsec Changes in release 3.23.32 @appendixsubsec Changes in release 3.23.32
@itemize @bullet @itemize @bullet
@item @item
Changed code to get around compiler bug in Compaq C++ on OSF1, that broke
@code{BACKUP, RESTORE, CHECK, REPAIR, and ANALYZE TABLE}.
@item
Added option @code{FULL} to @code{SHOW COLUMNS}. Now we only show the Added option @code{FULL} to @code{SHOW COLUMNS}. Now we only show the
privilege list for the columns if this option is given. privilege list for the columns if this option is given.
@item @item
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#define ADMIN_VERSION "8.13" #define ADMIN_VERSION "8.14"
#define MAX_MYSQL_VAR 64 #define MAX_MYSQL_VAR 64
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */ #define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
...@@ -37,9 +37,9 @@ char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; ...@@ -37,9 +37,9 @@ char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN]; char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR]; ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0; static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,option_silent=0, static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0; opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0;
static uint tcp_port = 0, option_wait = 0; static uint tcp_port = 0, option_wait = 0, option_silent=0;
static ulong opt_connect_timeout; static ulong opt_connect_timeout;
static my_string unix_port=0; static my_string unix_port=0;
...@@ -201,7 +201,7 @@ int main(int argc,char *argv[]) ...@@ -201,7 +201,7 @@ int main(int argc,char *argv[])
} }
break; break;
case 's': case 's':
option_silent = 1; option_silent++;
break; break;
case 'S': case 'S':
unix_port= optarg; unix_port= optarg;
...@@ -367,21 +367,22 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -367,21 +367,22 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user,
fprintf(stderr,"Got error: %s\n", mysql_error(mysql)); fprintf(stderr,"Got error: %s\n", mysql_error(mysql));
if (!option_force) if (!option_force)
return 1; return 1;
sleep(5);
} }
else if (!info) else if (!option_silent)
{ {
info=1; if (!info)
fputs("Waiting for MySQL server to answer",stderr); {
(void) fflush(stderr); info=1;
sleep(5); fputs("Waiting for MySQL server to answer",stderr);
} (void) fflush(stderr);
else }
{ else
putc('.',stderr); {
(void) fflush(stderr); putc('.',stderr);
sleep(5); (void) fflush(stderr);
}
} }
sleep(5);
} }
} }
...@@ -739,7 +740,10 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -739,7 +740,10 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_PING: case ADMIN_PING:
mysql->reconnect=0; /* We want to know of reconnects */ mysql->reconnect=0; /* We want to know of reconnects */
if (!mysql_ping(mysql)) if (!mysql_ping(mysql))
puts("mysqld is alive"); {
if (option_silent < 2)
puts("mysqld is alive");
}
else else
{ {
if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR)
......
...@@ -433,6 +433,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, ...@@ -433,6 +433,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_mutex_wait #undef pthread_mutex_wait
#undef pthread_mutex_timedwait #undef pthread_mutex_timedwait
#undef pthread_mutex_t #undef pthread_mutex_t
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B)) #define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__) #define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) #define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
......
...@@ -43,8 +43,6 @@ PATH=$PATH:/usr/bsd ...@@ -43,8 +43,6 @@ PATH=$PATH:/usr/bsd
hostname=`hostname` # Install this too in the user table hostname=`hostname` # Install this too in the user table
hostname="$hostname%" # Fix if not fully qualified hostname hostname="$hostname%" # Fix if not fully qualified hostname
resolved=127.0.0.1
#create the directories #create the directories
[ -d $vardir ] || mkdir $vardir [ -d $vardir ] || mkdir $vardir
...@@ -144,9 +142,7 @@ then ...@@ -144,9 +142,7 @@ then
i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
REPLACE INTO user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
REPLACE INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
REPLACE INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); INSERT INTO user VALUES ('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');" INSERT INTO user VALUES ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');"
......
...@@ -35,6 +35,7 @@ RM=rm ...@@ -35,6 +35,7 @@ RM=rm
TIME=time TIME=time
TR=tr TR=tr
XARGS=`which xargs | head -1` XARGS=`which xargs | head -1`
SED=sed
# Are we using a source or a binary distribution? # Are we using a source or a binary distribution?
...@@ -72,7 +73,7 @@ BASEDIR=`pwd` ...@@ -72,7 +73,7 @@ BASEDIR=`pwd`
cd $CWD cd $CWD
MYSQL_TEST_DIR=$BASEDIR/mysql-test MYSQL_TEST_DIR=$BASEDIR/mysql-test
STD_DATA=$MYSQL_TEST_DIR/std_data STD_DATA=$MYSQL_TEST_DIR/std_data
SED=sed hostname=`hostname` # Installed in the mysql privilege table
TESTDIR="$MYSQL_TEST_DIR/t/" TESTDIR="$MYSQL_TEST_DIR/t/"
TESTSUFFIX=test TESTSUFFIX=test
...@@ -238,10 +239,9 @@ SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov ...@@ -238,10 +239,9 @@ SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
# Function Definitions # Function Definitions
#-- #--
wait_for_server_start () wait_for_server_start ()
{ {
$MYSQL --no-defaults -u $DBUSER -e "select 1" --silent -w1 --host=127.0.0.1 --port=$1 \ $MYSQLADMIN --no-defaults -u $DBUSER --silent -w2 --host=$hostname --port=$1 ping >/dev/null
>/dev/null }
}
prompt_user () prompt_user ()
{ {
......
...@@ -7,7 +7,7 @@ Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Rep ...@@ -7,7 +7,7 @@ Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Rep
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 4 No 127.0.0.1 root 9306 60 4 No
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 4 Yes 127.0.0.1 root 9306 60 master-bin.001 73 Yes
n n
10 10
45 45
......
...@@ -13,6 +13,7 @@ change master to master_host='127.0.0.1',master_user='root', ...@@ -13,6 +13,7 @@ change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=9306; master_password='',master_port=9306;
show slave status; show slave status;
slave start; slave start;
sleep 3;
show slave status; show slave status;
connection master; connection master;
drop table if exists foo; drop table if exists foo;
......
...@@ -27,6 +27,7 @@ create table t2(m int); ...@@ -27,6 +27,7 @@ create table t2(m int);
insert into t2 values (34),(67),(123); insert into t2 values (34),(67),(123);
flush logs; flush logs;
show master logs; show master logs;
sleep 2; # If a slow machine
purge master logs to 'master-bin.003'; purge master logs to 'master-bin.003';
show master logs; show master logs;
insert into t2 values (65); insert into t2 values (65);
......
...@@ -408,6 +408,7 @@ sweepstakes if you report the bug"; ...@@ -408,6 +408,7 @@ sweepstakes if you report the bug";
// slave // slave
break; break;
case LOG_READ_EOF: case LOG_READ_EOF:
DBUG_PRINT("wait",("waiting for data on binary log"));
pthread_cond_wait(&COND_binlog_update, log_lock); pthread_cond_wait(&COND_binlog_update, log_lock);
break; break;
......
...@@ -799,74 +799,76 @@ static int send_check_errmsg(THD* thd, TABLE_LIST* table, ...@@ -799,74 +799,76 @@ static int send_check_errmsg(THD* thd, TABLE_LIST* table,
static int prepare_for_restore(THD* thd, TABLE_LIST* table) static int prepare_for_restore(THD* thd, TABLE_LIST* table)
{ {
String *packet = &thd->packet; String *packet = &thd->packet;
DBUG_ENTER("prepare_for_restore");
if(table->table) // do not overwrite existing tables on restore if (table->table) // do not overwrite existing tables on restore
{ {
return send_check_errmsg(thd, table, "restore", DBUG_RETURN(send_check_errmsg(thd, table, "restore",
"table exists, will not overwrite on restore" "table exists, will not overwrite on restore"
); ));
} }
else else
{ {
char* backup_dir = thd->lex.backup_dir; char* backup_dir = thd->lex.backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->name; char* table_name = table->name;
char* db = thd->db ? thd->db : table->db; char* db = thd->db ? thd->db : table->db;
if(!fn_format(src_path, table_name, backup_dir, reg_ext, 4 + 64))
return -1; // protect buffer overflow
sprintf(dst_path, "%s/%s/%s", mysql_real_data_home, db, table_name); if (!fn_format(src_path, table_name, backup_dir, reg_ext, 4 + 64))
DBUG_RETURN(-1); // protect buffer overflow
int lock_retcode; sprintf(dst_path, "%s/%s/%s", mysql_real_data_home, db, table_name);
pthread_mutex_lock(&LOCK_open);
if((lock_retcode = lock_table_name(thd, table)) < 0)
{
pthread_mutex_unlock(&LOCK_open);
return -1;
}
if(lock_retcode && wait_for_locked_table_names(thd, table)) int lock_retcode;
{ pthread_mutex_lock(&LOCK_open);
unlock_table_name(thd, table); if((lock_retcode = lock_table_name(thd, table)) < 0)
pthread_mutex_unlock(&LOCK_open); {
return -1;
}
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(-1);
}
if(my_copy(src_path, if(lock_retcode && wait_for_locked_table_names(thd, table))
fn_format(dst_path, dst_path,"", {
reg_ext, 4), unlock_table_name(thd, table);
MYF(MY_WME))) pthread_mutex_unlock(&LOCK_open);
{ DBUG_RETURN(-1);
unlock_table_name(thd, table); }
return send_check_errmsg(thd, table, "restore", pthread_mutex_unlock(&LOCK_open);
"Failed copying .frm file");
}
bool save_no_send_ok = thd->net.no_send_ok;
thd->net.no_send_ok = 1;
// generate table will try to send OK which messes up the output
// for the client
if(generate_table(thd, table, 0)) if(my_copy(src_path,
{ fn_format(dst_path, dst_path,"",
unlock_table_name(thd, table); reg_ext, 4),
thd->net.no_send_ok = save_no_send_ok; MYF(MY_WME)))
return send_check_errmsg(thd, table, "restore", {
"Failed generating table from .frm file"); unlock_table_name(thd, table);
} DBUG_RETURN(send_check_errmsg(thd, table, "restore",
"Failed copying .frm file"));
}
bool save_no_send_ok = thd->net.no_send_ok;
thd->net.no_send_ok = 1;
// generate table will try to send OK which messes up the output
// for the client
if(generate_table(thd, table, 0))
{
unlock_table_name(thd, table);
thd->net.no_send_ok = save_no_send_ok; thd->net.no_send_ok = save_no_send_ok;
DBUG_RETURN(send_check_errmsg(thd, table, "restore",
"Failed generating table from .frm file"));
} }
return 0; thd->net.no_send_ok = save_no_send_ok;
}
DBUG_RETURN(0);
} }
static int mysql_admin_table(THD* thd, TABLE_LIST* tables, static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt, HA_CHECK_OPT* check_opt,
thr_lock_type lock_type,
bool open_for_modify,
const char *operator_name, const char *operator_name,
thr_lock_type lock_type,
bool open_for_modify, bool restore,
uint extra_open_options,
int (handler::*operator_func) int (handler::*operator_func)
(THD *, HA_CHECK_OPT *)) (THD *, HA_CHECK_OPT *))
{ {
...@@ -894,12 +896,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -894,12 +896,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
bool fatal_error=0; bool fatal_error=0;
strxmov(table_name,db ? db : "",".",table->name,NullS); strxmov(table_name,db ? db : "",".",table->name,NullS);
if (operator_func == &handler::repair || operator_func == &handler::check) thd->open_options|= extra_open_options;
thd->open_options|= HA_OPEN_FOR_REPAIR;
table->table = open_ltable(thd, table, lock_type); table->table = open_ltable(thd, table, lock_type);
thd->open_options&= ~HA_OPEN_FOR_REPAIR; thd->open_options&= ~extra_open_options;
packet->length(0); packet->length(0);
if (operator_func == &handler::restore) if (restore)
{ {
switch (prepare_for_restore(thd, table)) { switch (prepare_for_restore(thd, table)) {
case 1: continue; // error, message written to net case 1: continue; // error, message written to net
...@@ -1023,16 +1024,14 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list) ...@@ -1023,16 +1024,14 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
{ {
DBUG_ENTER("mysql_backup_table"); DBUG_ENTER("mysql_backup_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0, DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
TL_READ, 1, "backup", TL_READ, 1, 0, 0,
"backup",
&handler::backup)); &handler::backup));
} }
int mysql_restore_table(THD* thd, TABLE_LIST* table_list) int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
{ {
DBUG_ENTER("mysql_restore_table"); DBUG_ENTER("mysql_restore_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0, DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
TL_WRITE, 1, "restore", TL_WRITE, 1, 1,0,
"restore",
&handler::restore)); &handler::restore));
} }
...@@ -1040,8 +1039,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) ...@@ -1040,8 +1039,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_repair_table"); DBUG_ENTER("mysql_repair_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1, "repair", TL_WRITE, 1, 0, HA_OPEN_FOR_REPAIR,
"repair",
&handler::repair)); &handler::repair));
} }
...@@ -1049,8 +1047,7 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) ...@@ -1049,8 +1047,7 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_optimize_table"); DBUG_ENTER("mysql_optimize_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1, "optimize", TL_WRITE, 1,0,0,
"optimize",
&handler::optimize)); &handler::optimize));
} }
...@@ -1059,8 +1056,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) ...@@ -1059,8 +1056,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_analyze_table"); DBUG_ENTER("mysql_analyze_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 1, "analyze",TL_READ_NO_INSERT, 1,0,0,
"analyze",
&handler::analyze)); &handler::analyze));
} }
...@@ -1069,8 +1065,8 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt) ...@@ -1069,8 +1065,8 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_check_table"); DBUG_ENTER("mysql_check_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 0,
"check", "check",
TL_READ_NO_INSERT, 0, 0, HA_OPEN_FOR_REPAIR,
&handler::check)); &handler::check));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment