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.
@appendixsubsec Changes in release 3.23.32
@itemize @bullet
@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
privilege list for the columns if this option is given.
@item
......@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
#define ADMIN_VERSION "8.13"
#define ADMIN_VERSION "8.14"
#define MAX_MYSQL_VAR 64
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
......@@ -37,9 +37,9 @@ char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR];
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;
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 my_string unix_port=0;
......@@ -201,7 +201,7 @@ int main(int argc,char *argv[])
}
break;
case 's':
option_silent = 1;
option_silent++;
break;
case 'S':
unix_port= optarg;
......@@ -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));
if (!option_force)
return 1;
sleep(5);
}
else if (!info)
else if (!option_silent)
{
info=1;
fputs("Waiting for MySQL server to answer",stderr);
(void) fflush(stderr);
sleep(5);
}
else
{
putc('.',stderr);
(void) fflush(stderr);
sleep(5);
if (!info)
{
info=1;
fputs("Waiting for MySQL server to answer",stderr);
(void) fflush(stderr);
}
else
{
putc('.',stderr);
(void) fflush(stderr);
}
}
sleep(5);
}
}
......@@ -739,7 +740,10 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_PING:
mysql->reconnect=0; /* We want to know of reconnects */
if (!mysql_ping(mysql))
puts("mysqld is alive");
{
if (option_silent < 2)
puts("mysqld is alive");
}
else
{
if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR)
......
......@@ -433,6 +433,8 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_mutex_wait
#undef pthread_mutex_timedwait
#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_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
......
......@@ -43,8 +43,6 @@ PATH=$PATH:/usr/bsd
hostname=`hostname` # Install this too in the user table
hostname="$hostname%" # Fix if not fully qualified hostname
resolved=127.0.0.1
#create the directories
[ -d $vardir ] || mkdir $vardir
......@@ -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');
INSERT INTO user VALUES ('$hostname','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');
REPLACE INTO user VALUES ('127.0.0.1','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 ('$hostname','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N');"
......
......@@ -35,6 +35,7 @@ RM=rm
TIME=time
TR=tr
XARGS=`which xargs | head -1`
SED=sed
# Are we using a source or a binary distribution?
......@@ -72,7 +73,7 @@ BASEDIR=`pwd`
cd $CWD
MYSQL_TEST_DIR=$BASEDIR/mysql-test
STD_DATA=$MYSQL_TEST_DIR/std_data
SED=sed
hostname=`hostname` # Installed in the mysql privilege table
TESTDIR="$MYSQL_TEST_DIR/t/"
TESTSUFFIX=test
......@@ -238,10 +239,9 @@ SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
# Function Definitions
#--
wait_for_server_start ()
{
$MYSQL --no-defaults -u $DBUSER -e "select 1" --silent -w1 --host=127.0.0.1 --port=$1 \
>/dev/null
}
{
$MYSQLADMIN --no-defaults -u $DBUSER --silent -w2 --host=$hostname --port=$1 ping >/dev/null
}
prompt_user ()
{
......
......@@ -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
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
127.0.0.1 root 9306 60 4 Yes
127.0.0.1 root 9306 60 master-bin.001 73 Yes
n
10
45
......
......@@ -13,6 +13,7 @@ change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=9306;
show slave status;
slave start;
sleep 3;
show slave status;
connection master;
drop table if exists foo;
......
......@@ -27,6 +27,7 @@ create table t2(m int);
insert into t2 values (34),(67),(123);
flush logs;
show master logs;
sleep 2; # If a slow machine
purge master logs to 'master-bin.003';
show master logs;
insert into t2 values (65);
......
......@@ -408,6 +408,7 @@ sweepstakes if you report the bug";
// slave
break;
case LOG_READ_EOF:
DBUG_PRINT("wait",("waiting for data on binary log"));
pthread_cond_wait(&COND_binlog_update, log_lock);
break;
......
......@@ -799,74 +799,76 @@ static int send_check_errmsg(THD* thd, TABLE_LIST* table,
static int prepare_for_restore(THD* thd, TABLE_LIST* table)
{
String *packet = &thd->packet;
DBUG_ENTER("prepare_for_restore");
if(table->table) // do not overwrite existing tables on restore
{
return send_check_errmsg(thd, table, "restore",
"table exists, will not overwrite on restore"
);
}
if (table->table) // do not overwrite existing tables on restore
{
DBUG_RETURN(send_check_errmsg(thd, table, "restore",
"table exists, will not overwrite on restore"
));
}
else
{
char* backup_dir = thd->lex.backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->name;
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
{
char* backup_dir = thd->lex.backup_dir;
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char* table_name = table->name;
char* db = thd->db ? thd->db : table->db;
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;
pthread_mutex_lock(&LOCK_open);
if((lock_retcode = lock_table_name(thd, table)) < 0)
{
pthread_mutex_unlock(&LOCK_open);
return -1;
}
sprintf(dst_path, "%s/%s/%s", mysql_real_data_home, db, table_name);
if(lock_retcode && wait_for_locked_table_names(thd, table))
{
unlock_table_name(thd, table);
pthread_mutex_unlock(&LOCK_open);
return -1;
}
int lock_retcode;
pthread_mutex_lock(&LOCK_open);
if((lock_retcode = lock_table_name(thd, table)) < 0)
{
pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(-1);
}
if(my_copy(src_path,
fn_format(dst_path, dst_path,"",
reg_ext, 4),
MYF(MY_WME)))
{
unlock_table_name(thd, table);
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(lock_retcode && wait_for_locked_table_names(thd, table))
{
unlock_table_name(thd, table);
pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(-1);
}
pthread_mutex_unlock(&LOCK_open);
if(generate_table(thd, table, 0))
{
unlock_table_name(thd, table);
thd->net.no_send_ok = save_no_send_ok;
return send_check_errmsg(thd, table, "restore",
"Failed generating table from .frm file");
}
if(my_copy(src_path,
fn_format(dst_path, dst_path,"",
reg_ext, 4),
MYF(MY_WME)))
{
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;
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,
HA_CHECK_OPT* check_opt,
thr_lock_type lock_type,
bool open_for_modify,
const char *operator_name,
thr_lock_type lock_type,
bool open_for_modify, bool restore,
uint extra_open_options,
int (handler::*operator_func)
(THD *, HA_CHECK_OPT *))
{
......@@ -894,12 +896,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
bool fatal_error=0;
strxmov(table_name,db ? db : "",".",table->name,NullS);
if (operator_func == &handler::repair || operator_func == &handler::check)
thd->open_options|= HA_OPEN_FOR_REPAIR;
thd->open_options|= extra_open_options;
table->table = open_ltable(thd, table, lock_type);
thd->open_options&= ~HA_OPEN_FOR_REPAIR;
thd->open_options&= ~extra_open_options;
packet->length(0);
if (operator_func == &handler::restore)
if (restore)
{
switch (prepare_for_restore(thd, table)) {
case 1: continue; // error, message written to net
......@@ -1023,16 +1024,14 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
{
DBUG_ENTER("mysql_backup_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
TL_READ, 1,
"backup",
"backup", TL_READ, 1, 0, 0,
&handler::backup));
}
int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
{
DBUG_ENTER("mysql_restore_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
TL_WRITE, 1,
"restore",
"restore", TL_WRITE, 1, 1,0,
&handler::restore));
}
......@@ -1040,8 +1039,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_repair_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1,
"repair",
"repair", TL_WRITE, 1, 0, HA_OPEN_FOR_REPAIR,
&handler::repair));
}
......@@ -1049,8 +1047,7 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_optimize_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1,
"optimize",
"optimize", TL_WRITE, 1,0,0,
&handler::optimize));
}
......@@ -1059,8 +1056,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_analyze_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 1,
"analyze",
"analyze",TL_READ_NO_INSERT, 1,0,0,
&handler::analyze));
}
......@@ -1069,8 +1065,8 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_check_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 0,
"check",
TL_READ_NO_INSERT, 0, 0, HA_OPEN_FOR_REPAIR,
&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