diff options
author | unknown <monty@donna.mysql.com> | 2001-01-22 15:33:34 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-22 15:33:34 +0200 |
commit | 3e54e5393293426a9bfb7e6036f7e12bdb71d3b5 (patch) | |
tree | ccd9b5c441de00d24eee19f6c4a55a4b4b7bfc6d | |
parent | 6632102983d7f413d77f3f735ec8b22f5ffdcdaf (diff) | |
download | mariadb-git-3e54e5393293426a9bfb7e6036f7e12bdb71d3b5.tar.gz |
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
-rw-r--r-- | Docs/manual.texi | 3 | ||||
-rw-r--r-- | client/mysqladmin.c | 38 | ||||
-rw-r--r-- | include/my_pthread.h | 2 | ||||
-rw-r--r-- | mysql-test/install_test_db.sh | 6 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 10 | ||||
-rw-r--r-- | mysql-test/r/rpl000015.result | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000015.test | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl000016.test | 1 | ||||
-rw-r--r-- | sql/sql_repl.cc | 1 | ||||
-rw-r--r-- | sql/sql_table.cc | 128 |
10 files changed, 98 insertions, 94 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index 5e295f4bbc8..2bac7dab66e 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -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 diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 35f7f341247..2a9d47edf44 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -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) diff --git a/include/my_pthread.h b/include/my_pthread.h index 6a5b8dcf5eb..c8d0d2c9d0a 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -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__) diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh index 3ee2aa42fad..e59b87cbe1c 100644 --- a/mysql-test/install_test_db.sh +++ b/mysql-test/install_test_db.sh @@ -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');" diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index c49a6e0bedf..a63e909d823 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -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 () { diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result index 45abae3976e..59a1a21be17 100644 --- a/mysql-test/r/rpl000015.result +++ b/mysql-test/r/rpl000015.result @@ -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 diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index b51a77ec873..db5b3c720b2 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -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; diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test index 1a75da49039..e5f1649a504 100644 --- a/mysql-test/t/rpl000016.test +++ b/mysql-test/t/rpl000016.test @@ -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); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 63cb378a1b9..f4564c025e0 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -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; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 68d2ab062c6..3e1a0eb9fa1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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)); } |