diff options
author | unknown <monty@hundin.mysql.fi> | 2002-08-18 16:04:26 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-08-18 16:04:26 +0300 |
commit | 457172d99256e68a93ab69eecbef23a3db7ef1c4 (patch) | |
tree | af1548211472940ebe3bad8ee24a4d2ab26f2c92 | |
parent | 36827564d3d8d6f18e13d79bebed75572c21f769 (diff) | |
download | mariadb-git-457172d99256e68a93ab69eecbef23a3db7ef1c4.tar.gz |
Fixed timing problem with rpl000001 replication test.
Fixed configure problems with HPUX and openbsd
SHOW SLAVE STATUS returns empty set if slave is not initialized
SHOW MASTER STATUS returns empty set if binary logging is not enabled.
Fixed shutdown problem on Solaris.
BitKeeper/deleted/.del-set_var.cc~5374527de1955359:
Delete: libmysqld/set_var.cc
BitKeeper/etc/ignore:
added libmysqld/set_var.cc
Build-tools/Do-compile:
Remove warnings from touch during compilation
Docs/manual.texi:
Changelog
client/mysqltest.c:
Added real_sleep command
configure.in:
Fixed type for HPUX10
innobase/configure.in:
Fixed type for openbsd
libmysql/libmysql.c:
Fix for new SHOW SLAVE STATUS
myisam/mi_update.c:
Update key file if using external locking
mysql-test/mysql-test-run.sh:
Safety fix
mysql-test/r/rpl000015.result:
Update for new SHOW SLAVE STATUS
mysql-test/r/rpl_empty_master_crash.result:
Update for new SHOW SLAVE STATUS
mysql-test/t/rpl000001.test:
sleep -> real_sleep to avoid timing problem
sql/mysqld.cc:
Fixed bug with SIGTERM on Solaris
sql/slave.cc:
SHOW SLAVE STATUS returns empty sets if slave is not initialized.
sql/sql_repl.cc:
SHOW MASTER STAT returns empty set if no binary logging.
-rw-r--r-- | .bzrignore | 1 | ||||
-rwxr-xr-x | Build-tools/Do-compile | 8 | ||||
-rw-r--r-- | Docs/manual.texi | 12 | ||||
-rw-r--r-- | client/mysqltest.c | 71 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | innobase/configure.in | 2 | ||||
-rw-r--r-- | libmysql/libmysql.c | 11 | ||||
-rw-r--r-- | myisam/mi_update.c | 6 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 2 | ||||
-rw-r--r-- | mysql-test/r/rpl000015.result | 1 | ||||
-rw-r--r-- | mysql-test/r/rpl_empty_master_crash.result | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl000001.test | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 10 | ||||
-rw-r--r-- | sql/slave.cc | 76 | ||||
-rw-r--r-- | sql/sql_repl.cc | 13 |
15 files changed, 127 insertions, 93 deletions
diff --git a/.bzrignore b/.bzrignore index 6a62ded71b2..8022245b859 100644 --- a/.bzrignore +++ b/.bzrignore @@ -493,3 +493,4 @@ sql-bench/innotest2a sql-bench/innotest2b myisam/test2.MYD myisam/test2.MYI +libmysqld/set_var.cc diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 58bd2e49a38..d262fc82f94 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -118,8 +118,12 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) safe_system("gunzip < $opt_distribution | $tar xf -"); # Fix file times; This is needed because the time for files may be - # in the future - system("touch timestamp; find . -newer timestamp -print | xargs touch; rm -f timestamp"); + # in the future. The following is done this way to ensure that + # we don't get any errors from xargs touch + system("touch timestamp"); + sleep(2); + system("touch timestamp2"); + system("find . -newer timestamp -print | xargs touch; rm -f timestamp"); sleep(2); # Ensure that files we don't want to rebuild are newer than other files safe_cd($ver); diff --git a/Docs/manual.texi b/Docs/manual.texi index d4859ac279a..4d8ebb622b7 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -8172,6 +8172,11 @@ Renamed mysqld startup options @code{--skip-locking} to @code{--skip-external-locking} and @code{--enable-locking} to @code{--external-locking}. @item +@code{SHOW MASTER STATUS} now returns an empty set if binary log is not +enabled. +@item +@code{SHOW SLAVE STATUS} now returns an empty set if slave is not initialized. +@item mysqld now has the option @code{--temp-pool} enabled by default as this gives better performance with some OS. @item @@ -50261,6 +50266,13 @@ each individual 4.0.x release. @itemize @bullet @item +Fixed shutdown problem (SIGTERM signal handling) on Solaris. (Bug from 4.0.2). +@item +@code{SHOW MASTER STATUS} now returns an empty set if binary log is not +enabled. +@item +@code{SHOW SLAVE STATUS} now returns an empty set if slave is not initialized. +@item Don't update MyISAM index file on update if not strictly necessary. @item Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY diff --git a/client/mysqltest.c b/client/mysqltest.c index a50e8e4a14c..cc253e21be1 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -178,7 +178,7 @@ struct connection* cur_con, *next_con, *cons_end; enum enum_commands { Q_CONNECTION=1, Q_QUERY, -Q_CONNECT, Q_SLEEP, +Q_CONNECT, Q_SLEEP, Q_REAL_SLEEP, Q_INC, Q_DEC, Q_SOURCE, Q_DISCONNECT, Q_LET, Q_ECHO, @@ -213,25 +213,45 @@ struct st_query enum enum_commands type; }; -const char *command_names[] = { - "connection", "query", - "connect", "sleep", - "inc", "dec", - "source", "disconnect", - "let", "echo", - "while", "end", - "system", "result", - "require", "save_master_pos", - "sync_with_master", "error", - "send", "reap", - "dirty_close", "replace_result", - "ping", "eval", - "rpl_probe", "enable_rpl_parse", - "disable_rpl_parse", "eval_result", - "enable_query_log", "disable_query_log", - "enable_result_log", "disable_result_log", - "server_start", "server_stop", - "require_manager", "wait_for_slave_to_stop", +const char *command_names[]= +{ + "connection", + "query", + "connect", + "sleep", + "real_sleep", + "inc", + "dec", + "source", + "disconnect", + "let", + "echo", + "while", + "end", + "system", + "result", + "require", + "save_master_pos", + "sync_with_master", + "error", + "send", + "reap", + "dirty_close", + "replace_result", + "ping", + "eval", + "rpl_probe", + "enable_rpl_parse", + "disable_rpl_parse", + "eval_result", + "enable_query_log", + "disable_query_log", + "enable_result_log", + "disable_result_log", + "server_start", + "server_stop", + "require_manager", + "wait_for_slave_to_stop", "require_version", 0 }; @@ -973,7 +993,7 @@ int do_sync_with_master(struct st_query* q) mysql_errno(mysql), mysql_error(mysql)); if (!(last_result = res = mysql_store_result(mysql))) - die("line %u: mysql_store_result() retuned NULL", start_lineno); + die("line %u: mysql_store_result() returned NULL", start_lineno); if (!(row = mysql_fetch_row(res))) die("line %u: empty result in %s", start_lineno, query_buf); if (!row[0]) @@ -1052,7 +1072,7 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused))) } -int do_sleep(struct st_query* q) +int do_sleep(struct st_query* q, my_bool real_sleep) { char* p=q->first_argument; struct timeval t; @@ -1064,7 +1084,7 @@ int do_sleep(struct st_query* q) #ifdef OS2 - if (opt_sleep) + if (opt_sleep && !real_sleep) DosSleep( opt_sleep * 1000); else DosSleep( atof( p) * 1000); @@ -1072,7 +1092,7 @@ int do_sleep(struct st_query* q) return 0; #else - if (opt_sleep) + if (opt_sleep && !real_sleep) t.tv_sec = opt_sleep; else { @@ -2394,7 +2414,8 @@ int main(int argc, char** argv) case Q_ENABLE_RESULT_LOG: disable_result_log=0; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; case Q_SOURCE: do_source(q); break; - case Q_SLEEP: do_sleep(q); break; + case Q_SLEEP: do_sleep(q, 0); break; + case Q_REAL_SLEEP: do_sleep(q, 1); break; case Q_REQUIRE_VERSION: do_require_version(q); break; case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break; case Q_REQUIRE_MANAGER: do_require_manager(q); break; diff --git a/configure.in b/configure.in index fd9fa35147c..d4ae062865d 100644 --- a/configure.in +++ b/configure.in @@ -893,7 +893,7 @@ case $SYSTEM_TYPE in *hpux10.20*) echo "Enabling workarounds for hpux 10.20" CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT HAVE_POSIX1003_4a_MUTEX" + CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX" if test "$with_named_thread" = "no" then echo "Using --with-named-thread=-lpthread" diff --git a/innobase/configure.in b/innobase/configure.in index ea518ef1dfd..ef9cbcf9310 100644 --- a/innobase/configure.in +++ b/innobase/configure.in @@ -97,7 +97,7 @@ case "$target_os" in sysv5uw7*) # Problem when linking on SCO CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - *-openbsd*) + openbsd*) CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; esac diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index bc07bf0367c..c6f88c1fb60 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1259,11 +1259,12 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql) return 1; } - if (!(row = mysql_fetch_row(res))) - goto err; - - /* check master host for emptiness/NULL */ - if (row[0] && *(row[0])) + row= mysql_fetch_row(res); + /* + Check master host for emptiness/NULL + For MySQL 4.0 it's enough to check for row[0] + */ + if (row && row[0] && *(row[0])) { /* this is a slave, ask it for the master */ if (get_master(mysql, res, row) || get_slaves_from_master(mysql)) diff --git a/myisam/mi_update.c b/myisam/mi_update.c index c52989f493e..1614d6ca19d 100644 --- a/myisam/mi_update.c +++ b/myisam/mi_update.c @@ -119,7 +119,11 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) } } } - if (changed) + /* + If we are running with external locking, we must update the index file + that something has changed + */ + if (changed || !my_disable_locking) key_changed|= HA_STATE_KEY_CHANGED; if (share->calc_checksum) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 146d6ba12ff..a4e9b0ea08a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -873,7 +873,7 @@ start_slave() --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \ --report-host=127.0.0.1 --report-user=root \ --report-port=$slave_port \ - --master-retry-count=5 \ + --master-retry-count=10 \ -O slave_net_timeout=10 \ $SMALL_SERVER \ $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result index a35004298e0..7010349e5ff 100644 --- a/mysql-test/r/rpl000015.result +++ b/mysql-test/r/rpl000015.result @@ -5,7 +5,6 @@ master-bin.001 79 reset slave; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space - 0 0 0 0 No No 0 0 0 0 change master to master_host='127.0.0.1'; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 66e28b32312..5a82df19ef5 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -7,6 +7,5 @@ slave start; drop table if exists t1; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space - 0 0 0 0 No No 0 0 0 0 load table t1 from master; Error in fetch_master_table diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index fb4255f27b3..0f195c65fb0 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -18,8 +18,10 @@ set password for root@"localhost" = password('foo'); connection slave; slave start; connection master; +# # Give slave time to do at last one failed connect retry -sleep 2; +# This one must be short so that the slave will not stop retrying +real_sleep 2; set password for root@"localhost" = password(''); # Give slave time to connect (will retry every second) sleep 2; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1ccbab496a9..d086dda3e9f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -706,12 +706,12 @@ void kill_mysql(void) #elif defined(OS2) pthread_cond_signal( &eventShutdown); // post semaphore #elif defined(HAVE_PTHREAD_KILL) - if (pthread_kill(signal_thread,SIGTERM)) /* End everything nicely */ + if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL)) { DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */ } #elif !defined(SIGNALS_DONT_BREAK_READ) - kill(current_pid,SIGTERM); + kill(current_pid, MYSQL_KILL_SIGNAL); #endif DBUG_PRINT("quit",("After pthread_kill")); shutdown_in_progress=1; // Safety if kill didn't work @@ -1459,8 +1459,8 @@ static void init_signals(void) sigaddset(&set,SIGQUIT); sigaddset(&set,SIGTERM); sigaddset(&set,SIGHUP); - signal(SIGTERM,SIG_DFL); // If it's blocked by parent - signal(SIGHUP,SIG_DFL); // If it's blocked by parent + sigset(SIGTERM, print_signal_warning); // If it's blocked by parent + sigset(SIGHUP, print_signal_warning); // If it's blocked by parent #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif @@ -1560,7 +1560,7 @@ static void *signal_hand(void *arg __attribute__((unused))) int error; // Used when debugging if (shutdown_in_progress && !abort_loop) { - sig=SIGTERM; + sig= SIGTERM; error=0; } else diff --git a/sql/slave.cc b/sql/slave.cc index 9873831cd28..c80b2090592 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1411,36 +1411,38 @@ int show_master_info(THD* thd, MASTER_INFO* mi) if (send_fields(thd, field_list, 1)) DBUG_RETURN(-1); - String* packet = &thd->packet; - packet->length(0); + if (mi->host[0]) + { + String *packet= &thd->packet; + packet->length(0); - pthread_mutex_lock(&mi->data_lock); - pthread_mutex_lock(&mi->rli.data_lock); - net_store_data(packet, mi->host); - net_store_data(packet, mi->user); - net_store_data(packet, (uint32) mi->port); - net_store_data(packet, (uint32) mi->connect_retry); - net_store_data(packet, mi->master_log_name); - net_store_data(packet, (longlong) mi->master_log_pos); - net_store_data(packet, mi->rli.relay_log_name + - dirname_length(mi->rli.relay_log_name)); - net_store_data(packet, (longlong) mi->rli.relay_log_pos); - net_store_data(packet, mi->rli.master_log_name); - net_store_data(packet, mi->slave_running ? "Yes":"No"); - net_store_data(packet, mi->rli.slave_running ? "Yes":"No"); - net_store_data(packet, &replicate_do_db); - net_store_data(packet, &replicate_ignore_db); - net_store_data(packet, (uint32)mi->rli.last_slave_errno); - net_store_data(packet, mi->rli.last_slave_error); - net_store_data(packet, mi->rli.slave_skip_counter); - net_store_data(packet, (longlong) mi->rli.master_log_pos); - net_store_data(packet, (longlong) mi->rli.log_space_total); - pthread_mutex_unlock(&mi->rli.data_lock); - pthread_mutex_unlock(&mi->data_lock); + pthread_mutex_lock(&mi->data_lock); + pthread_mutex_lock(&mi->rli.data_lock); + net_store_data(packet, mi->host); + net_store_data(packet, mi->user); + net_store_data(packet, (uint32) mi->port); + net_store_data(packet, (uint32) mi->connect_retry); + net_store_data(packet, mi->master_log_name); + net_store_data(packet, (longlong) mi->master_log_pos); + net_store_data(packet, mi->rli.relay_log_name + + dirname_length(mi->rli.relay_log_name)); + net_store_data(packet, (longlong) mi->rli.relay_log_pos); + net_store_data(packet, mi->rli.master_log_name); + net_store_data(packet, mi->slave_running ? "Yes":"No"); + net_store_data(packet, mi->rli.slave_running ? "Yes":"No"); + net_store_data(packet, &replicate_do_db); + net_store_data(packet, &replicate_ignore_db); + net_store_data(packet, (uint32)mi->rli.last_slave_errno); + net_store_data(packet, mi->rli.last_slave_error); + net_store_data(packet, mi->rli.slave_skip_counter); + net_store_data(packet, (longlong) mi->rli.master_log_pos); + net_store_data(packet, (longlong) mi->rli.log_space_total); + pthread_mutex_unlock(&mi->rli.data_lock); + pthread_mutex_unlock(&mi->data_lock); - if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) - DBUG_RETURN(-1); - + if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) + DBUG_RETURN(-1); + } send_eof(&thd->net); DBUG_RETURN(0); } @@ -1484,22 +1486,20 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, return -1; } DBUG_ASSERT(*master_log_name || master_log_pos == 0); + cmp_result = 0; if (*master_log_name) { /* - We should use dirname_length() here when we have a version of - this that doesn't modify the argument */ - char *basename = strrchr(master_log_name, FN_LIBCHAR); - if (basename) - ++basename; - else - basename = master_log_name; + TODO: + Replace strncmp() with a comparison function that + can handle comparison of the following files: + mysqlbin.999 + mysqlbin.1000 + */ + char *basename= master_log_name + dirname_length(master_log_name); cmp_result = strncmp(basename, log_name->ptr(), log_name->length()); } - else - cmp_result = 0; - pos_reached = ((!cmp_result && master_log_pos >= log_pos) || cmp_result > 0); if (pos_reached || thd->killed) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 9cc596f9bb5..8975a05ac3a 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1000,18 +1000,9 @@ int show_binlog_info(THD* thd) net_store_data(packet, (longlong)li.pos); net_store_data(packet, &binlog_do_db); net_store_data(packet, &binlog_ignore_db); + if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) + DBUG_RETURN(-1); } - else - { - net_store_null(packet); - net_store_null(packet); - net_store_null(packet); - net_store_null(packet); - } - - if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) - DBUG_RETURN(-1); - send_eof(&thd->net); DBUG_RETURN(0); } |