Commit a5edb200 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

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.
parent f7c8bd0e
...@@ -493,3 +493,4 @@ sql-bench/innotest2a ...@@ -493,3 +493,4 @@ sql-bench/innotest2a
sql-bench/innotest2b sql-bench/innotest2b
myisam/test2.MYD myisam/test2.MYD
myisam/test2.MYI myisam/test2.MYI
libmysqld/set_var.cc
...@@ -118,8 +118,12 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution) ...@@ -118,8 +118,12 @@ if ($opt_stage == 0 && ! $opt_use_old_distribution)
safe_system("gunzip < $opt_distribution | $tar xf -"); safe_system("gunzip < $opt_distribution | $tar xf -");
# Fix file times; This is needed because the time for files may be # Fix file times; This is needed because the time for files may be
# in the future # in the future. The following is done this way to ensure that
system("touch timestamp; find . -newer timestamp -print | xargs touch; rm -f timestamp"); # 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); sleep(2);
# Ensure that files we don't want to rebuild are newer than other files # Ensure that files we don't want to rebuild are newer than other files
safe_cd($ver); safe_cd($ver);
......
...@@ -8172,6 +8172,11 @@ Renamed mysqld startup options @code{--skip-locking} to ...@@ -8172,6 +8172,11 @@ Renamed mysqld startup options @code{--skip-locking} to
@code{--skip-external-locking} and @code{--enable-locking} to @code{--skip-external-locking} and @code{--enable-locking} to
@code{--external-locking}. @code{--external-locking}.
@item @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 mysqld now has the option @code{--temp-pool} enabled by default as this
gives better performance with some OS. gives better performance with some OS.
@item @item
...@@ -50261,6 +50266,13 @@ each individual 4.0.x release. ...@@ -50261,6 +50266,13 @@ each individual 4.0.x release.
@itemize @bullet @itemize @bullet
@item @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. Don't update MyISAM index file on update if not strictly necessary.
@item @item
Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY
...@@ -178,7 +178,7 @@ struct connection* cur_con, *next_con, *cons_end; ...@@ -178,7 +178,7 @@ struct connection* cur_con, *next_con, *cons_end;
enum enum_commands { enum enum_commands {
Q_CONNECTION=1, Q_QUERY, Q_CONNECTION=1, Q_QUERY,
Q_CONNECT, Q_SLEEP, Q_CONNECT, Q_SLEEP, Q_REAL_SLEEP,
Q_INC, Q_DEC, Q_INC, Q_DEC,
Q_SOURCE, Q_DISCONNECT, Q_SOURCE, Q_DISCONNECT,
Q_LET, Q_ECHO, Q_LET, Q_ECHO,
...@@ -213,25 +213,45 @@ struct st_query ...@@ -213,25 +213,45 @@ struct st_query
enum enum_commands type; enum enum_commands type;
}; };
const char *command_names[] = { const char *command_names[]=
"connection", "query", {
"connect", "sleep", "connection",
"inc", "dec", "query",
"source", "disconnect", "connect",
"let", "echo", "sleep",
"while", "end", "real_sleep",
"system", "result", "inc",
"require", "save_master_pos", "dec",
"sync_with_master", "error", "source",
"send", "reap", "disconnect",
"dirty_close", "replace_result", "let",
"ping", "eval", "echo",
"rpl_probe", "enable_rpl_parse", "while",
"disable_rpl_parse", "eval_result", "end",
"enable_query_log", "disable_query_log", "system",
"enable_result_log", "disable_result_log", "result",
"server_start", "server_stop", "require",
"require_manager", "wait_for_slave_to_stop", "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", "require_version",
0 0
}; };
...@@ -973,7 +993,7 @@ int do_sync_with_master(struct st_query* q) ...@@ -973,7 +993,7 @@ int do_sync_with_master(struct st_query* q)
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
if (!(last_result = res = mysql_store_result(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))) if (!(row = mysql_fetch_row(res)))
die("line %u: empty result in %s", start_lineno, query_buf); die("line %u: empty result in %s", start_lineno, query_buf);
if (!row[0]) if (!row[0])
...@@ -1052,7 +1072,7 @@ int do_disable_rpl_parse(struct st_query* q __attribute__((unused))) ...@@ -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; char* p=q->first_argument;
struct timeval t; struct timeval t;
...@@ -1064,7 +1084,7 @@ int do_sleep(struct st_query* q) ...@@ -1064,7 +1084,7 @@ int do_sleep(struct st_query* q)
#ifdef OS2 #ifdef OS2
if (opt_sleep) if (opt_sleep && !real_sleep)
DosSleep( opt_sleep * 1000); DosSleep( opt_sleep * 1000);
else else
DosSleep( atof( p) * 1000); DosSleep( atof( p) * 1000);
...@@ -1072,7 +1092,7 @@ int do_sleep(struct st_query* q) ...@@ -1072,7 +1092,7 @@ int do_sleep(struct st_query* q)
return 0; return 0;
#else #else
if (opt_sleep) if (opt_sleep && !real_sleep)
t.tv_sec = opt_sleep; t.tv_sec = opt_sleep;
else else
{ {
...@@ -2394,7 +2414,8 @@ int main(int argc, char** argv) ...@@ -2394,7 +2414,8 @@ int main(int argc, char** argv)
case Q_ENABLE_RESULT_LOG: disable_result_log=0; break; case Q_ENABLE_RESULT_LOG: disable_result_log=0; break;
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_SOURCE: do_source(q); 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_REQUIRE_VERSION: do_require_version(q); break;
case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(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; case Q_REQUIRE_MANAGER: do_require_manager(q); break;
......
...@@ -893,7 +893,7 @@ case $SYSTEM_TYPE in ...@@ -893,7 +893,7 @@ case $SYSTEM_TYPE in
*hpux10.20*) *hpux10.20*)
echo "Enabling workarounds for hpux 10.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" 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" if test "$with_named_thread" = "no"
then then
echo "Using --with-named-thread=-lpthread" echo "Using --with-named-thread=-lpthread"
......
...@@ -97,7 +97,7 @@ case "$target_os" in ...@@ -97,7 +97,7 @@ case "$target_os" in
sysv5uw7*) sysv5uw7*)
# Problem when linking on SCO # Problem when linking on SCO
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
*-openbsd*) openbsd*)
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac esac
......
...@@ -1259,11 +1259,12 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql) ...@@ -1259,11 +1259,12 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql)
return 1; return 1;
} }
if (!(row = mysql_fetch_row(res))) row= mysql_fetch_row(res);
goto err; /*
Check master host for emptiness/NULL
/* check master host for emptiness/NULL */ For MySQL 4.0 it's enough to check for row[0]
if (row[0] && *(row[0])) */
if (row && row[0] && *(row[0]))
{ {
/* this is a slave, ask it for the master */ /* this is a slave, ask it for the master */
if (get_master(mysql, res, row) || get_slaves_from_master(mysql)) if (get_master(mysql, res, row) || get_slaves_from_master(mysql))
......
...@@ -119,7 +119,11 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec) ...@@ -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; key_changed|= HA_STATE_KEY_CHANGED;
if (share->calc_checksum) if (share->calc_checksum)
......
...@@ -873,7 +873,7 @@ start_slave() ...@@ -873,7 +873,7 @@ start_slave()
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \ --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
--report-host=127.0.0.1 --report-user=root \ --report-host=127.0.0.1 --report-user=root \
--report-port=$slave_port \ --report-port=$slave_port \
--master-retry-count=5 \ --master-retry-count=10 \
-O slave_net_timeout=10 \ -O slave_net_timeout=10 \
$SMALL_SERVER \ $SMALL_SERVER \
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
......
...@@ -5,7 +5,6 @@ master-bin.001 79 ...@@ -5,7 +5,6 @@ master-bin.001 79
reset slave; reset slave;
show slave status; 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 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'; change master to master_host='127.0.0.1';
show slave status; 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 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
......
...@@ -7,6 +7,5 @@ slave start; ...@@ -7,6 +7,5 @@ slave start;
drop table if exists t1; drop table if exists t1;
show slave status; 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 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; load table t1 from master;
Error in fetch_master_table Error in fetch_master_table
...@@ -18,8 +18,10 @@ set password for root@"localhost" = password('foo'); ...@@ -18,8 +18,10 @@ set password for root@"localhost" = password('foo');
connection slave; connection slave;
slave start; slave start;
connection master; connection master;
#
# Give slave time to do at last one failed connect retry # 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(''); set password for root@"localhost" = password('');
# Give slave time to connect (will retry every second) # Give slave time to connect (will retry every second)
sleep 2; sleep 2;
......
...@@ -706,12 +706,12 @@ void kill_mysql(void) ...@@ -706,12 +706,12 @@ void kill_mysql(void)
#elif defined(OS2) #elif defined(OS2)
pthread_cond_signal( &eventShutdown); // post semaphore pthread_cond_signal( &eventShutdown); // post semaphore
#elif defined(HAVE_PTHREAD_KILL) #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 */ DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */
} }
#elif !defined(SIGNALS_DONT_BREAK_READ) #elif !defined(SIGNALS_DONT_BREAK_READ)
kill(current_pid,SIGTERM); kill(current_pid, MYSQL_KILL_SIGNAL);
#endif #endif
DBUG_PRINT("quit",("After pthread_kill")); DBUG_PRINT("quit",("After pthread_kill"));
shutdown_in_progress=1; // Safety if kill didn't work shutdown_in_progress=1; // Safety if kill didn't work
...@@ -1459,8 +1459,8 @@ static void init_signals(void) ...@@ -1459,8 +1459,8 @@ static void init_signals(void)
sigaddset(&set,SIGQUIT); sigaddset(&set,SIGQUIT);
sigaddset(&set,SIGTERM); sigaddset(&set,SIGTERM);
sigaddset(&set,SIGHUP); sigaddset(&set,SIGHUP);
signal(SIGTERM,SIG_DFL); // If it's blocked by parent sigset(SIGTERM, print_signal_warning); // If it's blocked by parent
signal(SIGHUP,SIG_DFL); // If it's blocked by parent sigset(SIGHUP, print_signal_warning); // If it's blocked by parent
#ifdef SIGTSTP #ifdef SIGTSTP
sigaddset(&set,SIGTSTP); sigaddset(&set,SIGTSTP);
#endif #endif
...@@ -1560,7 +1560,7 @@ static void *signal_hand(void *arg __attribute__((unused))) ...@@ -1560,7 +1560,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
int error; // Used when debugging int error; // Used when debugging
if (shutdown_in_progress && !abort_loop) if (shutdown_in_progress && !abort_loop)
{ {
sig=SIGTERM; sig= SIGTERM;
error=0; error=0;
} }
else else
......
...@@ -1411,7 +1411,9 @@ int show_master_info(THD* thd, MASTER_INFO* mi) ...@@ -1411,7 +1411,9 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
if (send_fields(thd, field_list, 1)) if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1); DBUG_RETURN(-1);
String* packet = &thd->packet; if (mi->host[0])
{
String *packet= &thd->packet;
packet->length(0); packet->length(0);
pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&mi->data_lock);
...@@ -1440,7 +1442,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi) ...@@ -1440,7 +1442,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1); DBUG_RETURN(-1);
}
send_eof(&thd->net); send_eof(&thd->net);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1484,22 +1486,20 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, ...@@ -1484,22 +1486,20 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
return -1; return -1;
} }
DBUG_ASSERT(*master_log_name || master_log_pos == 0); DBUG_ASSERT(*master_log_name || master_log_pos == 0);
cmp_result = 0;
if (*master_log_name) if (*master_log_name)
{ {
/* /*
We should use dirname_length() here when we have a version of TODO:
this that doesn't modify the argument */ Replace strncmp() with a comparison function that
char *basename = strrchr(master_log_name, FN_LIBCHAR); can handle comparison of the following files:
if (basename) mysqlbin.999
++basename; mysqlbin.1000
else */
basename = master_log_name; char *basename= master_log_name + dirname_length(master_log_name);
cmp_result = strncmp(basename, log_name->ptr(), cmp_result = strncmp(basename, log_name->ptr(),
log_name->length()); log_name->length());
} }
else
cmp_result = 0;
pos_reached = ((!cmp_result && master_log_pos >= log_pos) || pos_reached = ((!cmp_result && master_log_pos >= log_pos) ||
cmp_result > 0); cmp_result > 0);
if (pos_reached || thd->killed) if (pos_reached || thd->killed)
......
...@@ -1000,18 +1000,9 @@ int show_binlog_info(THD* thd) ...@@ -1000,18 +1000,9 @@ int show_binlog_info(THD* thd)
net_store_data(packet, (longlong)li.pos); net_store_data(packet, (longlong)li.pos);
net_store_data(packet, &binlog_do_db); net_store_data(packet, &binlog_do_db);
net_store_data(packet, &binlog_ignore_db); net_store_data(packet, &binlog_ignore_db);
}
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())) if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1); DBUG_RETURN(-1);
}
send_eof(&thd->net); send_eof(&thd->net);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
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